我已经运行了这个迁移:
class AddUniqueToLocationColumnName < ActiveRecord::Migration
def change
remove_index :locations, :name
add_index :locations, :name, unique: true
end
end
Run Code Online (Sandbox Code Playgroud)
现在我正在尝试回滚,但显示错误:
标准错误:发生错误,此迁移和所有后续迁移均已取消:remove_index 仅在给定 :column 选项时才可逆。
如何将此迁移回滚到我以前的版本?
我有一个带有属性名称的位置模型。我想修剪(删除多余的空格)整个 name 属性。
我试着跑
Location.TRIM(name)
Run Code Online (Sandbox Code Playgroud)
但它不起作用。查询错了吗?