2018-03-17 18:26:18 +05:30
|
|
|
# This migration comes from acts_as_taggable_on_engine (originally 6)
|
|
|
|
#
|
|
|
|
# It has been modified to handle no-downtime GitLab migrations. Several
|
|
|
|
# indexes have been removed since they are not needed for GitLab.
|
2019-01-03 12:48:30 +05:30
|
|
|
class AddMissingIndexesActsAsTaggableOnEngine < ActiveRecord::Migration
|
2018-03-17 18:26:18 +05:30
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
def up
|
|
|
|
add_concurrent_index :taggings, :tag_id unless index_exists? :taggings, :tag_id
|
|
|
|
add_concurrent_index :taggings, [:taggable_id, :taggable_type] unless index_exists? :taggings, [:taggable_id, :taggable_type]
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
remove_concurrent_index :taggings, :tag_id
|
|
|
|
remove_concurrent_index :taggings, [:taggable_id, :taggable_type]
|
|
|
|
end
|
|
|
|
end
|