/**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     //Truncate Database
     if ($this->option('database')) {
         $database = $this->option('database');
     } else {
         $database = $this->ask('What database do you want to truncate?');
     }
     if ($this->option('force') == "VALUE_NONE" or $this->confirm('Are you sure you want to truncate the database (' . $database . ')?')) {
         $this->comment(PHP_EOL . Migrator::TruncateDatabase($database) . PHP_EOL);
     }
 }
Example #2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     //Truncate Database and Clean Migration Files
     if ($this->option('database')) {
         $database = $this->option('database');
     } else {
         $database = $this->ask('What database do you want to truncate?');
     }
     if ($this->option('force') == "VALUE_NONE" or $this->confirm('Are you sure you want to truncate the database (' . $database . ')?')) {
         $this->comment(PHP_EOL . Migrator::TruncateDatabase($database) . PHP_EOL);
     }
     if ($this->option('force') == "VALUE_NONE" or $this->confirm('Are you sure you want to delete all migration files in the migrations folder?')) {
         $this->comment(PHP_EOL . Migrator::CleanMigrationsDirectory() . PHP_EOL);
     }
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if ($this->option('purge')) {
         if ($this->option('to') != "") {
             $database = $this->option('to');
         } else {
             $database = $this->ask('What database do you want to truncate?');
         }
         if ($this->option('force') == "VALUE_NONE" or $this->confirm('Are you sure you want to truncate the database (' . $database . ')?')) {
             $this->comment(PHP_EOL . Migrator::TruncateDatabase($database) . PHP_EOL);
         }
         if ($this->option('force') == "VALUE_NONE" or $this->confirm('Are you sure you want to delete all migration files in the migrations folder?')) {
             $this->comment(PHP_EOL . Migrator::CleanMigrationsDirectory() . PHP_EOL);
         }
     }
     if ($this->option('from') != "") {
         $from = $this->option('from');
     } else {
         $from = $this->ask('What database do you want to create the migrations from?');
     }
     $this->comment("Migrating from {$from}.");
     $this->comment(PHP_EOL . Migrator::PrepareMigrations($from) . PHP_EOL);
     $this->call('migrate');
 }