This blog is part of our Rails 6.1 series.
Rails 6.1 provides additional tasks to work with a specific database when working in a multi database setup.
Before Rails 6.1, only the following tasks worked on a specific database.
- rails db:migrate:primary
- rails db:create:primary
- rails db:drop:primary
But some tasks that could be applied to a specific database were missing. Let's checkout an example.
Before Rails 6.1, running a top level migration on a multi-database project, dumped the schema for all the configured databases, but if a database specific migration was run, the schema was not dumped. And there were no tasks to manually dump the schema of a specific database.
1 2> rails db:schema:dump:primary 3 4rails aborted! 5Don't know how to build task `db:schema:dump:primary` (See the list of available tasks with `rails --tasks`) 6Did you mean? db:schema:dump 7
Therefore, in Rails 6.1, the following database specific tasks were introduced.
- rails db:schema:dump:primary
- rails db:schema:load:primary
- rails db:test:prepare:primary
Check out the pull request for more details.