How to reverse an extend migration

I recently ran this migration while installing the fuzzily gem:

class AddTrigramsModel < ActiveRecord::Migration
  extend Fuzzily::Migration
end

From looking at my schema.rb file, it looks like the effect of this migration was:

  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"

Not sure if the easiest way is just to drop the table trigrams, or if there is a more appropriate method? I am assuming the indexes will be deleted on dropping the table?

Answers


Just run rake db:rollback. Fuzzily has support for rollbacks. Although everything it does is dropping the trigrams table :)

# lib/fuzzily/migration.rb:33
def down
  drop_table trigrams_table_name
end

Need Your Help

How to create CoffeeScript subclass with its own properties

inheritance coffeescript subclass

I am trying to do some simple subclassing in CoffeeScript

How to parse XML in PL/SQL

sql xml oracle xpath plsql

I have following xml struct in pl/sql: