Sha256: 7828144f6447aeedbe0bd5aa3e95a13e9bb17d3c41cd5ce416bc235f5aa178d6

Contents?: true

Size: 506 Bytes

Versions: 6

Compression:

Stored size: 506 Bytes

Contents

class ActsAsTaggableMigration < ActiveRecord::Migration
  def self.up
    create_table :tags do |t|
      t.string :name
    end
    
    create_table :taggings do |t|
      t.references :tag
      t.references :taggable, :polymorphic => true
      t.datetime   :created_at
    end
    
    add_index :tags, :name
    add_index :taggings, :tag_id
    add_index :taggings, [:taggable_id, :taggable_type]
  end
  
  def self.down
    drop_table :taggings
    drop_table :tags
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
protolif-acts_as_taggable_on_steroids-2.1.2 lib/generators/acts_as_taggable_migration/templates/migration.rb
protolif-acts_as_taggable_on_steroids-2.1.1 lib/generators/acts_as_taggable_migration/templates/migration.rb
bborn-acts_as_taggable_on_steroids-2.1 lib/generators/acts_as_taggable_migration/templates/migration.rb
bborn-acts_as_taggable_on_steroids-2.0.beta3 lib/generators/acts_as_taggable_migration/templates/migration.rb
bborn-acts_as_taggable_on_steroids-2.0.beta2 lib/generators/acts_as_taggable_migration/templates/migration.rb
acts_as_taggable3-2.0.beta2 lib/generators/acts_as_taggable_migration/templates/migration.rb