ruby-on-rails

rake db:rollback not working?


I'm writing my first Rails app. I've run a few rails generate model ... and rake db:migrate commands, but I now want to change my data model and so need to undo a few migrations.

The docs say I can undo a migration with rake db:rollback, but this isn't working. When I run this in the console the computer thinks for a few seconds but doesn't make any changes to db/migrate/ or db/migrate/schema.rb. No output is printed to the console.

Is this behavior correct? Shouldn't db:rollback be changing my schema? If so, can anyone think why it might not be working?

I'm on Rails v. 3.2.6.

EDIT

At the moment rake db:migrate:status gives

database: db/development.sqlite3

 Status   Migration ID    Migration Name
--------------------------------------------------
   up     20120617191211  Create irs
   up     20120701154357  Create paths
   up     20120701154421  Create nodes
   up     20120702151447  ********** NO FILE **********
  down    20120702155140  Create venues
  down    20120703233833  Remove path from venues

Solution

  • Solution (see my comment): run

    rake db:migrate:status
    

    and correct problems you find there. In this case (per @MarkThomas' followup), you might want to check all files you need are in place.