Skip to content
Permalink
Browse files

Add --default option to database:add (#4143)

This option allows to set the database as the default one instead of
adding a new database in addition to the default one.

See: #4142
  • Loading branch information...
Kwadz authored and enzolutions committed Sep 6, 2019
1 parent 3c83f02 commit c4a3b5ffe400c5619f98d953005d6f7585138cea
@@ -83,6 +83,12 @@ protected function configure()
InputOption::VALUE_OPTIONAL,
$this->trans('commands.database.add.options.driver')
)
->addOption(
'default',
null,
InputOption::VALUE_NONE,
$this->trans('commands.database.query.options.default')
)
->setHelp($this->trans('commands.database.add.help'))
->setAliases(['dba']);
}
@@ -26,8 +26,12 @@ public function generate(array $parameters)
if (!is_writable($settingsFile)) {
return false;
}
$template = 'database/add.php.twig';
if ($parameters['default']) {
$template = 'database/add-default.php.twig';
}
return $this->renderFile(
'database/add.php.twig',
$template,
$settingsFile,
$parameters,
FILE_APPEND
@@ -0,0 +1,10 @@

$databases['default']['default'] = [
'database' => '{{ database }}',
'username' => '{{ username }}',
'password' => '{{ password }}',
'host' => '{{ host }}',
'port' => '{{ port }}',
'driver' => '{{ driver }}',
'prefix' => '{{ prefix }}',
];

0 comments on commit c4a3b5f

Please sign in to comment.
You can’t perform that action at this time.