我最近在安装模糊 gem 时运行了此迁移:
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"
不确定最简单的方法是否只是删除表三元组,或者是否有更合适的方法?我假设删除表时索引将被删除?