Allow 3-level DB configs to group connections by environment#28095
Allow 3-level DB configs to group connections by environment#28095matthewd merged 1 commit intorails:masterfrom
Conversation
|
Really like the simplification 👍 |
606f41c to
b744d5f
Compare
[Arthur Nogueira Neves & Matthew Draper]
b744d5f to
0a4f600
Compare
|
I'm interested in this feature and have a basic question. Are I'm thinking about if it enables to create two connections, one is Background: Oracle enhanced adapter is supporting database links to connect to another database via a database link, but database link is hard to support such as getting correct metadata and performance over a database link. Thanks. |
No. In itself, this feature does nothing more than allow That makes it a bit easier to combine with @arthurnn's previous work in and around #24844, to potentially teach models to use more than one connection. (Hence the primary/readonly example names here.) But on its own, this is just about allowing people to move from: development:
<<: *default
database: db/development.sqlite3
development_another:
<<: *default
database: db/dev-another.sqlite3
production:
<<: *default
database: db/production.sqlite3
production_another:
<<: *default
database: db/prod-another.sqlite3to: development:
primary:
<<: *default
database: db/development.sqlite3
another:
<<: *default
database: db/dev-another.sqlite3
production:
primary:
<<: *default
database: db/production.sqlite3
another:
<<: *default
database: db/prod-another.sqlite3and most significantly, from How those additional connection details are used, is still up to the application. |
|
Thanks for the explanation. I think I understand how it will work. Hope it gets merged to Rails 5.1 |
|
I'm not sure if this works, or what I make wrong here and I understand the behaviour of this feature. I have the following in development:
primary:
adapter: oracle_enhanced
host: oracle_db
port: 1521
database: app_development
username: normal_user
password: password
migration:
adapter: oracle_enhanced
host: oracle_db
port: 1521
database: app_development
username: migration_user
password: passwordWe need to have a special user with privileges to create schema (don't ask why). So I'd like to rewrite But if I run the application I got: I thought the |
|
@deepj I am interested in this feature but not familiar with it yet, if you reproduce with this only with Oracle enhanced adapter 1.8.0.beta1 and Rails 5.1.0.beta1, would you open an issue https://github.com/rsim/oracle-enhanced |
|
Does this mean users are expected to be aware that there are reserved keywords at the 2nd level, including obscure ones like |
|
@yahonda I'm sorry for the late answer. In the end the problem was somewhere else. Everything else works like a charm. |
|
@deepj What was the issue you were having... I'm running into the same thing. My database.yml looks like: defaults: &defaults
adapter: postgresql
encoding: utf8
reconnect: false
host: localhost
pool: 16
development:
primary:
<<: *defaults
database: first_database
read_replica:
<<: *defaults
database: second_database
test:
primary:
<<: *defaults
database: first_database_test
read_replica:
<<: *defaults
database: second_database_testError: |
Cut-down take on the key part of #27611
Still to do:
Rails.envcall, which has long been inside AR, but really shouldn't beThis gets us a shippable implementation of the headline feature for #27611, though: