Fixture Migrations in Rails

15 Jun 2007

(This is the third of three posts on Rails fixtures)

Awhile back Josh Cronemeyer approached me with an idea to migrate fixtures in Rails. The problem we were trying to solve is when your database changes you need to edit all the fixture files to reflect the change – which usually doesn’t happen and then things break/get weird. We spent a few hours hashing out the basic plan (load all the fixtures into the db, migrate, then write the db out to the fixture files) and writing some code. Then he went off, tested it, and made it work with (very) occasional input from me. He’s written up a nice post on the topic called How to Migrate Fixtures in Rails and has posted the code at Google Code.

Go check it out if you hate migrating fixtures by hand.