views:

380

answers:

2

Is there a rake task that shows the pending migrations in a rails app?

+2  A: 

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 Test
Run "rake db:migrate" to update your database then try again.
theIV
A: 

Try rake -h (help) and have a look at rake -n (= rake --dry-run). So probably something like rake -n db:migrate should get you what you want.

John Lockwood