示例#1
0
 public function run($argumentData, $optionData)
 {
     $configName = $argumentData->get('config', 'default');
     $migrator = $this->builder->migrator($configName);
     $action = $argumentData->getRequired('action');
     if (!in_array($action, array('create', 'drop'))) {
         throw new CommandException("ACTION must be either 'create' or 'drop'");
     }
     $this->{$action}($migrator, $optionData);
 }
示例#2
0
文件: Seed.php 项目: phpixie/migrate
 public function run($argumentData, $optionData)
 {
     $configName = $argumentData->get('config', 'default');
     $seeder = $this->builder->seeder($configName);
     $output = $this->builder->cliOutput($this->cliContext());
     try {
         $seeder->seed($output, $optionData->get('truncate', false));
     } catch (\Exception $e) {
         throw new CommandException($e->getMessage());
     }
     $this->writeLine("Seed data successfully inserted.");
 }
示例#3
0
 public function run($argumentData, $optionData)
 {
     $configName = $argumentData->get('config', 'default');
     $migrator = $this->builder->migrator($configName);
     $output = $this->builder->cliOutput($this->cliContext());
     try {
         $executed = $migrator->migrate($output);
     } catch (\Exception $e) {
         throw new CommandException($e->getMessage());
     }
     if (empty($executed)) {
         $this->writeLine("Already on latest version.");
         return;
     }
     $count = count($executed);
     $this->writeLine("Applied {$count} migration(s)");
 }