Sha256: 05af24aa662ded3db1816d79c22f856ead432f2bbd5ae1bdf67f3268ad729260

Contents?: true

Size: 750 Bytes

Versions: 2

Compression:

Stored size: 750 Bytes

Contents

class GutentagTables < ActiveRecord::Migration
  def up
    create_table :gutentag_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 :gutentag_taggings, :tag_id
    add_index :gutentag_taggings, [:taggable_type, :taggable_id]
    add_index :gutentag_taggings, [:taggable_type, :taggable_id, :tag_id],
      :unique => true, :name => 'unique_taggings'

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

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

  def down
    drop_table :gutentag_tags
    drop_table :gutentag_taggings
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gutentag-0.5.1 db/migrate/1_gutentag_tables.rb
gutentag-0.5.0 db/migrate/1_gutentag_tables.rb