rake db:rollback not working?

Solution 1:

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.

Solution 2:

This is what worked for me. Combine the steps given in this answer and comment by dB.

  1. run rake db:migrate:status
  2. If you have a ****NO FILE**** entry, just note the version number as noFileVersion. Note the version of the entry just above no file entry(stable_version).
  3. created a "dummy" file with name noFileVersion_create_nothing.rb, and body
class CreateNothing < ActiveRecord::Migration[6.0] 
  def change 
  end 
end
  1. run rake db:migrate VERSION=stable_version
  2. remove the noFileVersion_create_nothing.rb manually.
  3. run rake db:migrate.
  4. run rake db:migrate:status again to check if No file entry has disappeared.

Solution 3:

The following worked for me: rake db:migrate:down VERSION=20190304092208

Version number can be obtained by the following command: rake db:migrate:status

This was the last version number to rollback one last migration