Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[database:add] add option to add settings to $databases['default']['default'] #4142

Closed
Kwadz opened this issue Aug 30, 2019 · 4 comments
Closed

Comments

@Kwadz
Copy link
Contributor

Kwadz commented Aug 30, 2019

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.

@enzolutions
Copy link
Contributor

Hi @Kwadz I understand your suggestion and I like it, please do the PR the template should be located next to https://github.com/hechoendrupal/drupal-console/blob/master/templates/database/add.php.twig

Kwadz pushed a commit to Kwadz/drupal-console that referenced this issue Sep 1, 2019
This option allows to set the database as the default one instead of
adding a new database in addition to the default one.

See: hechoendrupal#4142
enzolutions pushed a commit that referenced this issue Sep 6, 2019
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
@Kwadz
Copy link
Contributor Author

Kwadz commented Sep 11, 2019

@enzolutions, I tried to fork and do a pull request on https://github.com/hechoendrupal/drupal-console-book to update the doc but I realised this repo is read-only. Would you know how I can update the doc for this new command?

@enzolutions
Copy link
Contributor

@Kwadz The docs for commands are generated based in command translations https://github.com/hechoendrupal/drupal-console-en

@enzolutions
Copy link
Contributor

enzolutions commented Sep 11, 2019

BTW last month we migrate the documentation to use GatsbyJS, so the repository https://github.com/hechoendrupal/drupal-console-book was declared archived and replaced by https://github.com/hechoendrupal/drupalconsole.com/tree/master/content/docs

In case you are interested in translate something else than commands.

enzolutions pushed a commit that referenced this issue Oct 10, 2019
* Update services.yml

* Fix Travis tests

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* 1

* Ensure $roles is an array when creating users. (#4134)

This prevents an error from being thrown when constructing the success message.  See #4133.

* Generate revisional entity content is broken (#4139)

* Add bundle permissions for content entity (#4138)

* Add command option has-bundle-permissions and use on entity.

* Add (Entity}Permissions.php file.

* Add permission_callback to permissions.yml file.

* Added fix from #4139 as it hurts.

* Add own permissions checks.

* 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

* Update version to 1.9.3 (#4144)

* Update version to 1.9.3

* Remove Module/InstallCommand::moduleRequirement

* Remove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants