Sha256: 3dd82d32e5899f0c18f2a7c2db768f9fd138e4bd00cf7a04e242eac603faef07

Contents?: true

Size: 673 Bytes

Versions: 19

Compression:

Stored size: 673 Bytes

Contents

class TagTables < ActiveRecord::Migration
  def up
    create_table :taggings do |t|
      t.integer :tag_id,        :null => false
      t.integer :taggable_id,   :null => false
      t.string  :taggable_type, :null => false
      t.timestamps
    end

    add_index :taggings, :tag_id
    add_index :taggings, [:taggable_type, :taggable_id]
    add_index :taggings, [:taggable_type, :taggable_id, :tag_id],
      :unique => true, :name => 'unique_taggings'

    create_table :tags do |t|
      t.string :name, :null => false
      t.timestamps
    end

    add_index :tags, :name, :unique => true
  end

  def down
    drop_table :tags
    drop_table :taggings
  end
end

Version data entries

19 entries across 19 versions & 8 rubygems

Version Path
tag_ramaprasad-1.0.1 db/migrate/1_tag_tables.rb
my_tags-1.0.0 db/migrate/1_tag_tables.rb
my_tags-0.0.9 db/migrate/1_tag_tables.rb
my_tags-0.0.8 db/migrate/1_tag_tables.rb
my_tags-0.0.7 db/migrate/1_tag_tables.rb
my_tags-0.0.6 db/migrate/1_tag_tables.rb
my_tags-0.0.5 db/migrate/1_tag_tables.rb
my_tags-0.0.4 db/migrate/1_tag_tables.rb
my_tags-0.0.3 db/migrate/1_tag_tables.rb
my_tags-0.0.2 db/migrate/1_tag_tables.rb
tag_bat-0.1.0 db/migrate/1_tag_tables.rb
tag_bat-0.0.3 db/migrate/1_tag_tables.rb
tag_bat-0.0.2 db/migrate/1_tag_tables.rb
tag_ringtail-0.1.0 db/migrate/1_tag_tables.rb
tag_ringtail-0.0.2 db/migrate/1_tag_tables.rb
etiqueta_rails-0.0.2 spec/internal/db/migrate/1_tag_tables.rb
tag_apidae-0.0.2 db/migrate/1_tag_tables.rb
tag_simonsez-0.0.2 db/migrate/1_tag_tables.rb
tag_echidna-0.1.0 db/migrate/1_tag_tables.rb