public function handle($request)
 {
     parent::handle($request);
     $this->initTracker();
     $migrations = $this->app->getTrackedMigrations();
     $this->checkNonMigrated($migrations);
     foreach ($migrations as $id => $migration) {
         if ($migration->status == 'new') {
             $this->printMigration($migration);
             $this->register($migration);
             if (!empty($migration->before)) {
                 $this->setStatus($migration, 'before');
                 Utilities::exec($migration->before);
             }
             $this->setStatus($migration, 'loading...');
             $this->app->getTracker()->load($migration);
             if (!empty($migration->after)) {
                 $this->setStatus($migration, 'after');
                 Utilities::exec($migration->after);
             }
             $this->setStatus($migration, 'migrated');
             echo "\n";
         }
     }
     echo "All migrated\n";
 }
Example #2
0
 public function load($migration)
 {
     $report = $cmd = $this->buildCmd($this->options, $migration);
     if (!empty($this->options['password'])) {
         $options = $this->options;
         $options['password'] = '******';
         $report = $this->buildCmd($options, $migration);
     }
     Utilities::exec($cmd, $report);
 }