Improve check for pending migrations: Run psql command like heroku toolbelt does. Get local migrations from source code rather than local database state.