1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge branch 'fix_database_yml_example_in_mutltiple_databases_rails_guide' into main

This commit is contained in:
eileencodes 2021-03-10 10:44:19 -05:00
commit fc20050ea6
No known key found for this signature in database
GPG key ID: BA5C575120BBE8DF

View file

@ -49,8 +49,9 @@ The `database.yml` looks like this:
```yaml ```yaml
production: production:
database: my_primary_database database: my_primary_database
user: root
adapter: mysql2 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 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: production:
primary: primary:
database: my_primary_database database: my_primary_database
user: root username: root
password: <%= ENV['ROOT_PASSWORD'] %>
adapter: mysql2 adapter: mysql2
primary_replica: primary_replica:
database: my_primary_database database: my_primary_database
user: root_readonly username: root_readonly
password: <%= ENV['ROOT_READONLY_PASSWORD'] %>
adapter: mysql2 adapter: mysql2
replica: true replica: true
animals: animals:
database: my_animals_database database: my_animals_database
user: animals_root username: animals_root
password: <%= ENV['ANIMALS_ROOT_PASSWORD'] %>
adapter: mysql2 adapter: mysql2
migrations_paths: db/animals_migrate migrations_paths: db/animals_migrate
animals_replica: animals_replica:
database: my_animals_database database: my_animals_database
user: animals_readonly username: animals_readonly
password: <%= ENV['ANIMALS_READONLY_PASSWORD'] %>
adapter: mysql2 adapter: mysql2
replica: true replica: true
``` ```