The command database:add does not allow to create the first database defined by $databases['default']['default']. This can be useful in case a fresh install that you want to connect to an existing database. Currently the command only allows adding database in addition to the default one.
I suggest adding an option like --default to add the default database. The current template add.php.twig is:
$databases['{{ database }}']['default'] = [
'database' => '{{ database }}',
'username' => '{{ username }}',
'password' => '{{ password }}',
'host' => '{{ host }}',
'port' => '{{ port }}',
'driver' => '{{ driver }}',
'prefix' => '{{ prefix }}',
];
I suggest adding add-default.php.twig:
$databases['default']['default'] = [
'database' => '{{ database }}',
'username' => '{{ username }}',
'password' => '{{ password }}',
'host' => '{{ host }}',
'port' => '{{ port }}',
'driver' => '{{ driver }}',
'prefix' => '{{ prefix }}',
];
This new template would be called instead, when using --default option.
What do you think? I'd be pleased to do a pull request.
The command
database:adddoes not allow to create the first database defined by$databases['default']['default']. This can be useful in case a fresh install that you want to connect to an existing database. Currently the command only allows adding database in addition to the default one.I suggest adding an option like
--defaultto add the default database. The current templateadd.php.twigis:I suggest adding
add-default.php.twig:This new template would be called instead, when using
--defaultoption.What do you think? I'd be pleased to do a pull request.