Creating an alias that migrates both development and test databases in rails project

Problem

In your rails project very often, after creating a new migration, you have to run the migration in the development database and then in the test database.

Solution

A neat way to combine both these steps as one, taken from the book Rails 4 in Action, is to create an alias in your ~/.bashrc configuration file with the following, so that you only have to run migrate after each migration that would apply the migration in both development and test databases:

alias migrate='bin/rake db:migrate && bin/rake db:test:prepare'