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:
commit
fc20050ea6
1 changed files with 10 additions and 5 deletions
|
@ -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
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue