2016-11-23 151 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方法中的內容並再次運行遷移。

雖然評論內容將確保查詢或命令不會再次運行給你另一個錯誤