Show pending migrations in rails Show pending migrations in rails ruby-on-rails ruby-on-rails

Show pending migrations in rails


rake db:migrate:status (Rails 3 to 5) or rails db:migrate:status (Rails 5) will accomplish this. See this commit.

up means the migration has been run. down means the migration has not been run.


There is rake db:abort_if_pending_migrations (at least in Rails 2.3.3, not sure when it was introduced). The description says 'Raises an error if there are pending migrations'. This seems to be used more as a prerequisite for other tasks, but I'm guessing you could use it for your purposes.

EDIT: Here is an example of the output after having just generated and not run a 'test' migration

rails_project theIV$ rake db:abort_if_pending_migrations(in /Users/theIV/Sites/rails_project/)You have 1 pending migrations:  20090828200602 TestRun "rake db:migrate" to update your database then try again.


This command will list all migrations with their status (UP or DOWN)

Rails 3 and 4

rake db:migrate:status

Rails 5

rake db:migrate:status# Orrails db:migrate:status