If you’re lazy like me and don’t want to keep repeating
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:
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.