Skip to content

Commit

Permalink
hechoendrupal#3535 Add no-db option to migrate:execute command
Browse files Browse the repository at this point in the history
  • Loading branch information
Angel Hanari committed Sep 29, 2017
1 parent 058dcc6 commit 5e84d53
Showing 1 changed file with 45 additions and 36 deletions.
81 changes: 45 additions & 36 deletions src/Command/Migrate/ExecuteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
;
}
Expand All @@ -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');

Expand Down

0 comments on commit 5e84d53

Please sign in to comment.