Last Updated: February 25, 2016
·
1.837K
· relistan

Detecting Rails migrations before you deploy

There are a number of workflows for discovering pending Rails migrations. Most involve pushing the code up to an app server and running a Rake task to see if the schema is up to date. That's slow, not automatic, and can be a hassle.

Git can help by tagging your releases and comparing the changes in the db/migrations directory. Your deployment framework can make that automatic so you don't accidentally deploy code with pending migrations.

I have written a plugin for Capistrano that does just that.

http://github.com/mydrive/capistrano-detect-migrations

or from Rubygems.org

gem install capistrano-detect-migrations