Sha256: 5834247433801fba8a6fc1261a2ce680d3428db0b6b46cd242734d7c548fb0ae

Contents?: true

Size: 557 Bytes

Versions: 1

Compression:

Stored size: 557 Bytes

Contents

class ActsAsTaggableOnMigration < ActiveRecord::Migration
  def self.up
    create_table :tags do |t|
      t.string :name
    end

    create_table :taggings do |t|
      t.integer :tag_id
      t.references :tagger, :polymorphic => true
      t.references :taggable, :polymorphic => true
      t.string :context
      t.datetime :created_at
    end

    add_index :tags, :name
    add_index :taggings, :tag_id
    add_index :taggings, [:taggable_id, :taggable_type, :context]
  end

  def self.down
    drop_table :taggings
    drop_table :tags
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lawrencepit-acts-as-taggable-on-1.0.1 generators/acts_as_taggable_on_migration/templates/migration.rb