Reno, NV    +1 (800)0 621-0871

Go back

Ruby on Rails | Tutorial

Migrating development db and test db simultaneously

  |  January 14, 2011

If you’re lazy like me and don’t want to keep repeating

rails db:migrate rails db:migrate RAILS_ENV=test

every time you create a migration, just bind them together using alias. Open up your .bash_profile(or create one if you haven’t already) and paste this:

alias migrate='rake db:migrate; rake db:migrate RAILS_ENV=test'

Now the next time you have to migrate, just type:

migrate

and you’re all set! You can also have fun and do all those other rake stuff and alias them all like rake db:seed or something.

Enjoy!