we are updating from rails 5 to rails 6. we are currently using the ar_octopus
gem for database shrading.
Looks like the rails supports database shrading
by default from rails 6.
I have updated the database.yml
file like so
test:
primary:
adapter: postgresql
database: test
username: postgres
password: root
host: localhost
main:
adapter: postgresql
user: postgres
database: "<%= ENV['API_MAIN_DATABASE_NAME'] %>"
host: "<%= ENV['API_DATABASE_HOST'] %>"
password: "<%= ENV['API_DATABASE_PASSWORD'] %>"
database_tasks: false
replica: false
prediction:
adapter: postgresql
user: postgres
database: "<%= ENV['API_PREDICTION_DATABASE_NAME'] %>"
host: "<%= ENV['API_DATABASE_HOST'] %>"
password: "<%= ENV['API_DATABASE_PASSWORD'] %>"
database_tasks: false
replica: false
onshore:
adapter: postgresql
user: postgres
database: "<%= ENV['API_US_ONSHORE_DATABASE_NAME'] %>"
host: "<%= ENV['API_DATABASE_HOST'] %>"
password: "<%= ENV['API_DATABASE_PASSWORD'] %>"
database_tasks: false
replica: false
If i run RAILS_ENV=test rails db:migrate
looks like it still tries to run migration on all the databases.
database_tasks: false
does not seem to work as intended.
may be i am missing something, is it not available in rails 6
?
do i need to be on rails 7 for this to be available?
CodePudding user response:
database_tasks: false does not seem to work as intended. may be i am missing something, is it not available in rails 6? do i need to be on rails 7 for this to be available?
Yes, the database_tasks:
option was added in 7.0
by https://github.com/rails/rails/pull/42794