Sha256: 40c4fdfd1b61e4c1caac5258724dee47ef11686a82f8a3ba56f687890a7b56fc

Contents?: true

Size: 730 Bytes

Versions: 13

Compression:

Stored size: 730 Bytes

Contents

# frozen_string_literal: true

class ActsAsTaggableOnMigration < ActiveRecord::Migration[4.2]
  def self.up
    create_table :tags do |t|
      t.column :name, :string
    end

    create_table :taggings do |t|
      t.integer :tag_id
      t.integer :taggable_id
      t.integer :tagger_id
      t.string :tagger_type

      # You should make sure that the column created is
      # long enough to store the required class names.
      t.string :taggable_type, limit: 50
      t.string :context, limit: 50

      t.column :created_at, :datetime
    end

    add_index :taggings, :tag_id
    add_index :taggings, %i[taggable_id taggable_type context]
  end

  def self.down
    drop_table :taggings
    drop_table :tags
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
fat_free_crm-0.22.1 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.22.0 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.21.0 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.20.1 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.20.0 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.19.2 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.19.0 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.18.2 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.17.3 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.18.1 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.18.0 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.17.2 db/migrate/20100928030627_acts_as_taggable_on_migration.rb
fat_free_crm-0.17.1 db/migrate/20100928030627_acts_as_taggable_on_migration.rb