DataMigration adds the ability to create data migration files (similar to Rails schema migrations) and migrate them. The main benefit is they are separate from Rails schema migrations and can therefore be run at different stages.
- Run 'one off' rake tasks
- Run data inserts/updates, separate from schema migrations
Add this line to your application's Gemfile:
gem 'data_migration', github: 'ashmckenzie/data_migration'
And then execute:
$ bundle
$ rails generate data_migration:install
$ rake db:migrate
This drops a new schema migration into db/migrate
called YYYYMMDDHHMMSS_add_data_migration_support.rb
and creates a new data_migrations
table.
$ rails generate data_migration:new <name_of_migration>
$ rake db:data_migrate
$ rake db:data_migrate:rollback STEP=1
$ rake db:data_migrate:rollback VERSION=YYYYMMDDHHMMSS
$ rake db:data_migrate:status
- Specs!
- 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