rake db:rollback not working?

前端 未结 4 1017
半阙折子戏
半阙折子戏 2020-12-24 11:12

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

4条回答
  •  离开以前
    2020-12-24 11:42

    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 
      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.

提交回复
热议问题