I decided to describe here a number of things I miss in my developer routines regarding migrations.
db:rollback
task
Currently, to rollback you have to find a specific migration name and execute rake 'db:migrate[12345678123456]'
. Additional complication is that rom-sql documentation on migrations lacks information about rollbacks, and sequel docs only mention “specifying the target version”.
I think that by far the most common use case for a rollback is when a developer wants to rollback the last one or two migrations locally during development. So, it would be nice to have a db:rollback
command to simplify that process.
Additionally, would be cool to support rake db:rollback STEP=2
syntax (matching rails) to rollback several migrations at once. This can be done with Sequel::Migrator
’s relative
option
allow_missing_migration_files
support for db:migrate
I switch between features-in-development branches several times a day. Some of them have migrations, and whenever I switch to another one forgetting to revert them, db:migrate
starts failing with “migration … is not in the filesystem”.
This makes me wish that I could pass migrator: {allow_missing_migration_files: true}
to ROM::Configuration.new
in development only. Currently this is not possible, cause db:migrate
doesn’t pass that option by itself for obvious reasons, and ROM::SQL::Migrations::Migrator
doesn’t mix it into Sequel::Migrator
options in #run
Wdyt? Does any of that sound reasonable?