What do you think about the idea of adding some callbacks to extend ActiveRecord migrations. It originates from the following challenge.
One of the blockers for switching from
schema.rb to more powerful and low-level
schema.sql format is that the resulting SQL depends on the exact environment in which migrations are run. In big application with dozens of remote developers of different level, it can be hard to enforce the same environment context (like the version of the database, the current locale etc.).
To address the problem I’d like to have some mechanizm like callbacks (or some middleware) for running migrator. Having this option I could just add validations to be invoked by the
Migrator.run. AFAIK, the only way of doing it now is monkey patching of the
ActiveRecord::Migrator which is a durty, hacky and brittle way of doing things.
Do you think the problem worths adding callbacks, or you can recommend a better way of solving the problem?