Sha256: 26a60b23ac6c843e917d11af6f417e0fd3ec4062da5735d449fe6e8e1741dcc0

Contents?: true

Size: 893 Bytes

Versions: 11

Compression:

Stored size: 893 Bytes

Contents

# frozen_string_literal: true

# A migration to add tables for Tag and Tagging. This file is automatically generated and added to your app if you run the tagging generator included with has_many_polymorphs.

class CreateTagsAndTaggings < ActiveRecord::Migration[4.2]
  # Add the new tables.
  def self.up
    create_table :tags do |t|
      t.column :name, :string, null: false
    end
    add_index :tags, :name, unique: true

    create_table :taggings do |t|
      t.column :tag_id, :integer, null: false
      t.column :taggable_id, :integer, null: false
      t.column :taggable_type, :string, null: false
      # t.column :position, :integer # Uncomment this if you need to use <tt>acts_as_list</tt>.
    end
    add_index :taggings, %i[tag_id taggable_id taggable_type], unique: true
  end

  # Remove the tables.
  def self.down
    drop_table :tags
    drop_table :taggings
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
koalagator-4.1.0 db/migrate/20080705164959_create_tags_and_taggings.rb
koalagator-4.0.0 db/migrate/20080705164959_create_tags_and_taggings.rb
koalagator-3.0.0 db/migrate/20080705164959_create_tags_and_taggings.rb
koalagator-2.1.1 db/migrate/20080705164959_create_tags_and_taggings.rb
koalagator-2.1.0 db/migrate/20080705164959_create_tags_and_taggings.rb
koalagator-2.0.0 db/migrate/20080705164959_create_tags_and_taggings.rb
calagator2-2.1.1 db/migrate/20080705164959_create_tags_and_taggings.rb
calagator2-2.1.0 db/migrate/20080705164959_create_tags_and_taggings.rb
calagator2-2.0.0 db/migrate/20080705164959_create_tags_and_taggings.rb
calagator-2.0.0.pre.1 db/migrate/20080705164959_create_tags_and_taggings.rb
calagator-2.0.0.pre.0 db/migrate/20080705164959_create_tags_and_taggings.rb