我已经运行这个迁移:迁移不会回滚
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