Fix database.yml example in multiple databases Rails Guide

* Change :user to :username
* Add :password
This commit is contained in:
ryu39 2021-02-28 02:05:18 +09:00 committed by eileencodes
parent 7240fb636b
commit 0bbc293b77
No known key found for this signature in database
GPG Key ID: BA5C575120BBE8DF
1 changed files with 10 additions and 5 deletions

View File

@ -49,8 +49,9 @@ The `database.yml` looks like this:
```yaml
production:
database: my_primary_database
user: root
adapter: mysql2
username: root
password: <%= ENV['ROOT_PASSWORD'] %>
```
Let's add a replica for the first configuration, and a second database called animals and a
@ -67,21 +68,25 @@ will use `[CONFIGURATION_NAMESPACE]_schema.rb` for the filename.
production:
primary:
database: my_primary_database
user: root
username: root
password: <%= ENV['ROOT_PASSWORD'] %>
adapter: mysql2
primary_replica:
database: my_primary_database
user: root_readonly
username: root_readonly
password: <%= ENV['ROOT_READONLY_PASSWORD'] %>
adapter: mysql2
replica: true
animals:
database: my_animals_database
user: animals_root
username: animals_root
password: <%= ENV['ANIMALS_ROOT_PASSWORD'] %>
adapter: mysql2
migrations_paths: db/animals_migrate
animals_replica:
database: my_animals_database
user: animals_readonly
username: animals_readonly
password: <%= ENV['ANIMALS_READONLY_PASSWORD'] %>
adapter: mysql2
replica: true
```