我最近在安装模糊宝石时运行了这个迁移:
class AddTrigramsModel < ActiveRecord::Migration
extend Fuzzily::Migration
end
从查看我的schema.rb文件看,这次迁移的效果似乎是:
create_table "trigrams", :force => true do |t|
t.string "trigram", :limit => 3
t.integer "score", :limit => 2
t.integer "owner_id"
t.string "owner_type"
t.string "fuzzy_field"
end
add_index "trigrams", ["owner_id", "owner_type", "fuzzy_field", "trigram", "score"], :name => "index_for_match"
add_index "trigrams", ["owner_id", "owner_type"], :name => "index_by_owner"
不确定最简单的方法是删除表三元组,还是有更合适的方法?我假设在删除表时会删除索引吗?
答案 0 :(得分:0)
只需运行rake db:rollback
。 Fuzzily支持回滚。虽然它所做的一切都是放下三卦表:)
# lib/fuzzily/migration.rb:33
def down
drop_table trigrams_table_name
end