Commit f0e2efc6 authored by Krasimir Angelov's avatar Krasimir Angelov

Merge branch 'pb-taggings-conditionally-drop-index' into 'master'

Drop taggings index if exists during migration

See merge request gitlab-org/gitlab!71606
parents d23a3d00 a6b354de
......@@ -75,13 +75,13 @@ class FinalizeTagginsBigintConversion < ActiveRecord::Migration[6.1]
# Rename the index on the `bigint` column to match the new column name
# (we already hold an exclusive lock, so no need to use DROP INDEX CONCURRENTLY here)
execute 'DROP INDEX index_taggings_on_taggable_id_and_taggable_type'
execute 'DROP INDEX IF EXISTS index_taggings_on_taggable_id_and_taggable_type'
rename_index TABLE_NAME, 'i_taggings_on_taggable_id_convert_to_bigint_and_taggable_type', 'index_taggings_on_taggable_id_and_taggable_type'
execute 'DROP INDEX index_taggings_on_taggable_id_and_taggable_type_and_context'
execute 'DROP INDEX IF EXISTS index_taggings_on_taggable_id_and_taggable_type_and_context'
rename_index TABLE_NAME, 'i_taggings_on_taggable_bigint_and_taggable_type_and_context', 'index_taggings_on_taggable_id_and_taggable_type_and_context'
execute 'DROP INDEX taggings_idx'
execute 'DROP INDEX IF EXISTS taggings_idx'
rename_index TABLE_NAME, 'taggings_idx_tmp', 'taggings_idx'
execute 'DROP INDEX tmp_index_taggings_on_id_where_taggable_type_project'
execute 'DROP INDEX IF EXISTS tmp_index_taggings_on_id_where_taggable_type_project'
rename_index TABLE_NAME, 'tmp_index_taggings_on_id_bigint_where_taggable_type_project', 'tmp_index_taggings_on_id_where_taggable_type_project'
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment