This repo is not maintained.
ArCheckedMigration provides a utility for specifying which migrations to be run are 'safe' or not. It is up to you to specify in your migration whether or not it is safe.
Once each migration has done so, you can use the task below to determine if all migrations to be run are safe, which would mean you wouldn't have to put your application into maintenance mode during a deploy.
Safe Migrations are generally considered to be:
- New tables, columns, indexes
- Data changes
Unsafe Migrations include:
- table or column renames
- removing a table or column
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install ar_checked_migration
To determine if your migrations to run are safe, you can simply run
Note that if you're NOT using Rails, you'll need to manually specify the migrations directories AND the schema_migrations table name before running the runner. Something like:
ArCheckedMigration::Runner.migrations = ActiveRecord::Migrator.migrations(['some', 'paths', 'here']) ArCheckedMigration::Runner.table_name = 'schema_migrations' ArCheckedMigration::Runner.safe?
Migrations themselves are a subclass of
ActiveRecord::CheckedMigration instead of
A typical migration will look like
class MyMigration < ActiveRecord::CheckedMigration # Set to true or false depending on the type of migration is_safe true def change # do some stuff end end
is_safe is not set or an
ActiveRecord::Migration migration is used, it is assumed to be unsafe.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request