我已經運行這個遷移:遷移不會回滾
class AddUniqueToLocationColumnName < ActiveRecord::Migration
def change
remove_index :locations, :name
add_index :locations, :name, unique: true
end
end
,現在我想回滾,但其示值誤差:
StandardError: An error has occurred, this and all later migrations canceled: remove_index is only reversible if given a :column option.
我怎麼可以回滾此遷移到我以前的版本?
嘗試將其更改爲'remove_index:位置,柱:name' – max
我想現在你必須從你的遷移中手動刪除位置和名稱索引使用remove_index方法。爲此,您可以創建新遷移或更改爲向上和向下狀態。 –
非常感謝。有效。只需要指定「列::名稱」,而不是隻有「名稱」:) – Abhishek