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
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
```