protected function _execute(array $params)
 {
     if (!Migration::is_installed()) {
         Migration::install();
     }
     Migration::rollback($messages);
     if (empty($messages)) {
         Minion_CLI::write('Nothing to rollback');
     } else {
         foreach ($messages as $message) {
             Minion_CLI::write($message[0]);
             if (isset($message[1])) {
                 Minion_CLI::write('ERROR: ' . $message[1]);
             } else {
                 Minion_CLI::write('OK');
             }
         }
     }
 }
Ejemplo n.º 2
0
 public function action($argv)
 {
     $command = $argv[1];
     if ($command == 'migrate' || $command == '-m') {
         $migration = new Migration();
         $migration->up();
     } elseif ($command == 'rollback' || $command == '-r') {
         $migration = new Migration();
         $migration->rollback();
     } elseif ($command == 'status' || $command == '-s') {
         $migration = new Migration();
         $migration->printStatus();
     } elseif ($command === 'help' || $command == '-h') {
         Debug::out('Command: -h (help)');
         Debug::out('migrate or -m');
         Debug::out('rollback or -r');
         Debug::out('status or -s');
     } else {
         Debug::out('Command unknown. Try -h for help.');
     }
 }