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); }
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."); }
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)"); }