protected function execute(InputInterface $input, OutputInterface $output) { $runner = new MigrationRunner($this->neptune['db'], new ConsoleLogger($output)); if ($input->getOption('force')) { $runner->ignoreExceptions(); } $module = $this->getModuleArgument($input, $output); $version = $input->getArgument('version'); if (!$version && $version !== '0') { //no version has been specified, so prompt for a version //by displaying all available migrations, highlighting the //current version. $migrations = $this->getMigrationsWithHighlight($runner, $module); $messages = array_values($migrations); $versions = array_keys($migrations); $prompt = sprintf('Select a migration for module <info>%s</info>:', $module->getName()); $dialog = $this->getHelper('dialog'); $index = $dialog->select($output, $prompt, $messages); $version = $versions[$index]; } $current = $runner->getCurrentVersion($module); if ((int) $version === (int) $current) { $output->writeln("Database is already at version {$version}"); return true; } $runner->migrate($module, $version); }
protected function execute(InputInterface $input, OutputInterface $output) { $runner = new MigrationRunner($this->neptune['db'], new ConsoleLogger($output)); if ($input->getOption('force')) { $runner->ignoreExceptions(); } foreach ($this->neptune->getModules() as $module) { try { $runner->migrateLatest($module); $output->writeln(sprintf('Module <info>%s</info> up to date', $module->getName())); } catch (MigrationNotFoundException $e) { //this means the module doesn't have a migrations //folder, so skip it continue; } } }