Пример #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     //Clean Migration Files
     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);
     }
 }
Пример #2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     //Create Migration Files
     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);
 }
Пример #3
0
 /**
  * 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);
     }
 }
Пример #4
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);
     }
 }
Пример #5
0
 /**
  * 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');
 }
Пример #6
0
 public static function PrepareMigrations($database)
 {
     $myLaravel = new Migrator();
     if ($database != "") {
         $myLaravel->SetDatabase($database);
     }
     $tables = $myLaravel->GetTables();
     foreach ($tables as $table) {
         $tablename = $table[0];
         $myLaravel->CreateMigrationsFile($tablename);
     }
     return "New Migration Files Created in " . self::GetMigrationsDirectory();
 }