Migration Alias

March 28, 2012

One thing I don’t do that I know I should, is validate that my down migration works properly.  I also always seem to forget to migrate my test database after I’ve set up a migration.  To help me out with this, I set up a simple alias to take care of both of these problems.  This is what I have in my zsh aliases:

alias rdb='rake db:migrate && rake db:migrate:redo && rake db:test:prepare'

This allows me, with one command, to migrate to the new version, pull back the migration, run it again and make sure that my test database is set up and ready.

Discussion, links, and tweets

I'm a Senior Software Engineer at Heroku

Follow me on Twitter. I rarely post anything but it can't hurt to try.