Migration options for multiple databases

We have a multiple database application where the primary database is the app’s own and the two other databases are legacy databases from Windows applications running in production.

We do not want to operate any migrations on these databases.

I noticed migrations take a long time with Rails 6. This is due to dumping schema on every database in the development: configuration.

So I can use config.active_record.dump_schema_after_migration to disable this dumping, but then I would lose out on the schema getting updated for my primary database.

Would it be purposeful to add an option to disable migrations for a given database, say if you have one that is readonly?

Maybe we could have configuration for the schema dump option with an array of databases to dump the schema for?

cc @eileencodes

Would it be purposeful to add an option to disable migrations for a given database, say if you have one that is readonly?

If your readonly db config has replica: true then the rake tasks, including the schema dump, ignore this configuration completely.

Maybe we could have configuration for the schema dump option with an array of databases to dump the schema for?

This reminded me of a PR I forgot to merge Add configuration option to skip dump per database by lfv89 · Pull Request #39326 · rails/rails · GitHub. I think that will solve your problem.

1 Like