Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rollback specific Databases with Active Record

Rails 6 has Multiple Databases with Active Record.

My question is what if I want to rollback a migration in one specific database?

something like this is not working:

rails db:rollback:primary

Link to "Multiple Databases with Active Record" documentation: https://edgeguides.rubyonrails.org/active_record_multiple_databases.html

like image 588
Navid Farjad Avatar asked Oct 03 '19 22:10

Navid Farjad


1 Answers

try run rails db:migrate:down:secondary VERSION=yourdbversionnumber.

I realized that this command are available when i try to run rails db:migrate:down and then rails give this in the terminal. Also, maybe for further details on rails db:migrate:down,refer to How to rollback a specific migration?

like image 173
Helmi Hidzir Avatar answered Oct 18 '22 19:10

Helmi Hidzir