MigrationDataDumper

So you’re playing around with your latest project which uses these brand spanky new migration thingies. You’re so edgy! You run

rake migrate VERSION=0
rake migrate

to make sure all your migrations are in proper order, and “Oh, Snap!”, all your data went ka-poof!

Sucks, donut? Well, I’m here to help.

This plugin adds two functions for use in migrations that will save and restore data for a single table into a fixture file.

  • save_table_to_fixture dumps data from the table into a fixture file.
  • restore_table_from_fixture copies the data from a fixture file into the table.

The fixtures are kept under #{RAILS_ROOT}/db/data/#{RAILS_ENV}/, and can then be version controlled (via svn, cvs, etc).

Tags

Currently tagged with: migrations
You need to Login to tag this item.