cirandas.net

ref: master

db/migrate/20140115190131_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# This migration comes from acts_as_taggable_on_engine (originally 1)
class ActsAsTaggableOnMigration < ActiveRecord::Migration
  def self.up
    change_table :taggings do |t|
      t.references :tagger, :polymorphic => true
      t.string :context, :limit => 128
    end
    add_index :taggings, [:taggable_id, :taggable_type, :context]
  end

  def self.down
    remove_index :taggings, [:taggable_id, :taggable_type, :context]
    change_table :taggings do |t|
      t.remove_references :tagger, :polymorphic => true
      t.remove :context
    end
  end
end