Sha256: ce5fafaa3f211fa56e65b82b8766f663cf003e728bfb9ee8c94068ce25fc032d

Contents?: true

Size: 1.06 KB

Versions: 63

Compression:

Stored size: 1.06 KB

Contents

class ActsAsTaggableOnSpreeMigration < ActiveRecord::Migration[4.2]
  def self.up
    create_table :spree_tags do |t|
      t.string :name
      t.integer :taggings_count, default: 0
    end

    create_table :spree_taggings do |t|
      t.references :tag

      # You should make sure that the column created is
      # long enough to store the required class names.
      t.references :taggable, polymorphic: true
      t.references :tagger, polymorphic: true

      # Limit is created to prevent MySQL error on index
      # length for MyISAM table type: http://bit.ly/vgW2Ql
      t.string :context, limit: 128

      t.datetime :created_at
    end

    add_index :spree_tags, :name, unique: true
    add_index :spree_taggings,
              [
                :tag_id,
                :taggable_id,
                :taggable_type,
                :context,
                :tagger_id,
                :tagger_type
              ],
              unique: true, name: "spree_taggings_idx"
  end

  def self.down
    drop_table :spree_taggings
    drop_table :spree_tags
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
spree_core-3.7.14.1 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.14 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.13 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.12 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.11 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.4.6 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.10 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.9 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.8 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.7 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.6 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.5 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.4 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.3 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.2 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.1 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.0 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.0.rc3 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.2.9 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb
spree_core-3.7.0.rc2 db/migrate/20160511071954_acts_as_taggable_on_spree_migration.rb