Sha256: 688ef49c3433d4cb669915c741b8a746050b82a20ba07b02c090f1c483ecddd3

Contents?: true

Size: 450 Bytes

Versions: 4

Compression:

Stored size: 450 Bytes

Contents

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

    create_table :taggings do |t|
      t.references :tag
      t.references :taggable, :polymorphic => true
    end

    add_index "tags", ['context', 'name']
    add_index "taggings", ['taggable_id', 'taggable_type']
  end
  
  def self.down
    drop_table :taggings
    drop_table :tags
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
scoped-tags-0.4.1 generators/scoped_tags_migration/templates/migration.rb
scoped-tags-0.4.0 generators/scoped_tags_migration/templates/migration.rb
scoped-tags-0.3.1 generators/scoped_tags_migration/templates/migration.rb
scoped-tags-0.3.0 generators/scoped_tags_migration/templates/migration.rb