2016-11-23 68 views
0
def self.down 
    # By default, we don't want to make any assumption about how to roll back a migration when your 
    # model already existed. Please edit below which fields you would like to remove in this migration. 
    raise ActiveRecord::IrreversibleMigration 
end 

我在色器件的迁移有这个,现在我已经rollbacked迁移..我得到了如何扭转不可逆转的迁移

`StandardError: An error has occurred, this and all later migrations canceled: 

ActiveRecord::IrreversibleMigration` 

错误现在,我无法访问模型,甚至耙后DB:迁移。如何使这项工作再次?

回答

0

不可逆转的迁移并不意味着扭转

不能扭转不可逆转的迁移。

因此,如果迁移是Down并且您希望它迁移Up只需注释up方法中的内容并再次运行迁移。

虽然评论内容将确保查询或命令不会再次运行给你另一个错误