0

我最近在安装模糊 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"

不确定最简单的方法是否只是删除表三元组,或者是否有更合适的方法?我假设删除表时索引将被删除?

4

1 回答 1

0

跑吧rake db:rollback。Fuzzily 支持回滚。尽管它所做的一切都是删除 trigrams 表:)

# lib/fuzzily/migration.rb:33
def down
  drop_table trigrams_table_name
end
于 2013-05-03T01:31:25.033 回答