From 5e84d53d26cc5c93af9524b6f563c5fc94f9e000 Mon Sep 17 00:00:00 2001 From: Angel Hanari Date: Fri, 29 Sep 2017 10:28:37 -0500 Subject: [PATCH] #3535 Add no-db option to migrate:execute command --- src/Command/Migrate/ExecuteCommand.php | 81 ++++++++++++++------------ 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/src/Command/Migrate/ExecuteCommand.php b/src/Command/Migrate/ExecuteCommand.php index 1e92b1144..998fc88aa 100644 --- a/src/Command/Migrate/ExecuteCommand.php +++ b/src/Command/Migrate/ExecuteCommand.php @@ -120,6 +120,12 @@ protected function configure() InputOption::VALUE_OPTIONAL, $this->trans('commands.migrate.execute.options.source-base-path') ) + ->addOption( + 'no-database', + 'no-db', + InputOption::VALUE_OPTIONAL, + $this->trans('commands.migrate.execute.options.no-database') + ) ->setAliases(['mie']); ; } @@ -138,67 +144,70 @@ protected function interact(InputInterface $input, OutputInterface $output) return $value; }; + // --no-database option + $no_database = $input->getOption('no-database'); + if (!$no_database) { - // --site-url option - $site_url = $input->getOption('site-url'); - if (!$site_url) { + // --site-url option + $site_url = $input->getOption('site-url'); + if (!$site_url) { $site_url = $io->ask( - $this->trans('commands.migrate.execute.questions.site-url'), - 'http://www.example.com', - $validator_required + $this->trans('commands.migrate.execute.questions.site-url'), + 'http://www.example.com', + $validator_required ); $input->setOption('site-url', $site_url); - } + } - // --db-type option - $db_type = $input->getOption('db-type'); - if (!$db_type) { + // --db-type option + $db_type = $input->getOption('db-type'); + if (!$db_type) { $db_type = $this->dbDriverTypeQuestion($io); $input->setOption('db-type', $db_type); - } - - // --db-host option - $db_host = $input->getOption('db-host'); - if (!$db_host) { + } + + // --db-host option + $db_host = $input->getOption('db-host'); + if (!$db_host) { $db_host = $this->dbHostQuestion($io); $input->setOption('db-host', $db_host); - } + } - // --db-name option - $db_name = $input->getOption('db-name'); - if (!$db_name) { + // --db-name option + $db_name = $input->getOption('db-name'); + if (!$db_name) { $db_name = $this->dbNameQuestion($io); $input->setOption('db-name', $db_name); - } + } - // --db-user option - $db_user = $input->getOption('db-user'); - if (!$db_user) { + // --db-user option + $db_user = $input->getOption('db-user'); + if (!$db_user) { $db_user = $this->dbUserQuestion($io); $input->setOption('db-user', $db_user); - } + } - // --db-pass option - $db_pass = $input->getOption('db-pass'); - if (!$db_pass) { + // --db-pass option + $db_pass = $input->getOption('db-pass'); + if (!$db_pass) { $db_pass = $this->dbPassQuestion($io); $input->setOption('db-pass', $db_pass); - } + } - // --db-prefix - $db_prefix = $input->getOption('db-prefix'); - if (!$db_prefix) { + // --db-prefix + $db_prefix = $input->getOption('db-prefix'); + if (!$db_prefix) { $db_prefix = $this->dbPrefixQuestion($io); $input->setOption('db-prefix', $db_prefix); - } + } - // --db-port prefix - $db_port = $input->getOption('db-port'); - if (!$db_port) { + // --db-port prefix + $db_port = $input->getOption('db-port'); + if (!$db_port) { $db_port = $this->dbPortQuestion($io); $input->setOption('db-port', $db_port); + } } - $this->registerMigrateDB($input, $io); $this->migrateConnection = $this->getDBConnection($io, 'default', 'upgrade');