Sha256: 829a33dd37edf5728c5569d2c9f98ec2e4fe990d76f4dc351ecb2d4249a8ad83

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

# This migration comes from acts_as_taggable_on_engine (originally 6)
if ActiveRecord.gem_version >= Gem::Version.new("5.0")
  class AddMissingIndexesOnTaggings < ActiveRecord::Migration[4.2]; end
else
  class AddMissingIndexesOnTaggings < ActiveRecord::Migration; end
end
AddMissingIndexesOnTaggings.class_eval do
  def change
    add_index :taggings, :tag_id unless index_exists? :taggings, :tag_id
    add_index :taggings, :taggable_id unless index_exists? :taggings, :taggable_id
    add_index :taggings, :taggable_type unless index_exists? :taggings, :taggable_type
    add_index :taggings, :tagger_id unless index_exists? :taggings, :tagger_id
    add_index :taggings, :context unless index_exists? :taggings, :context

    unless index_exists? :taggings, %i[tagger_id tagger_type]
      add_index :taggings, %i[tagger_id tagger_type]
    end

    unless index_exists? :taggings, %i[taggable_id taggable_type tagger_id context], name: "taggings_idy"
      add_index :taggings, %i[taggable_id taggable_type tagger_id context], name: "taggings_idy"
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
koalagator-4.1.0 db/migrate/20200327040656_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb
koalagator-4.0.0 db/migrate/20200327040656_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb
koalagator-3.0.0 db/migrate/20200327040656_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb
koalagator-2.1.1 db/migrate/20200327040656_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb
koalagator-2.1.0 db/migrate/20200327040656_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb
calagator2-2.1.1 db/migrate/20200327040656_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb
calagator2-2.1.0 db/migrate/20200327040656_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb