For Rails apps, only run migrations and restart after deploy if migrations pending

This only works for postgresql setups. Fixes https://github.com/fastestforward/heroku_san/issues/5.