diff options
Diffstat (limited to 'db/post_migrate/20210804153307_prepare_indexes_for_tagging_bigint_conversion.rb')
-rw-r--r-- | db/post_migrate/20210804153307_prepare_indexes_for_tagging_bigint_conversion.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/db/post_migrate/20210804153307_prepare_indexes_for_tagging_bigint_conversion.rb b/db/post_migrate/20210804153307_prepare_indexes_for_tagging_bigint_conversion.rb new file mode 100644 index 00000000000..98f90bafce3 --- /dev/null +++ b/db/post_migrate/20210804153307_prepare_indexes_for_tagging_bigint_conversion.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class PrepareIndexesForTaggingBigintConversion < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + def up + prepare_async_index :taggings, :id_convert_to_bigint, unique: true, + name: :index_taggings_on_id_convert_to_bigint + + prepare_async_index :taggings, [:taggable_id_convert_to_bigint, :taggable_type], + name: :i_taggings_on_taggable_id_convert_to_bigint_and_taggable_type + + prepare_async_index :taggings, [:taggable_id_convert_to_bigint, :taggable_type, :context], + name: :i_taggings_on_taggable_bigint_and_taggable_type_and_context + + prepare_async_index :taggings, [:tag_id, :taggable_id_convert_to_bigint, :taggable_type, :context, :tagger_id, :tagger_type], + unique: true, name: :taggings_idx_tmp + end + + def down + unprepare_async_index_by_name :taggings, :taggings_idx_tmp + + unprepare_async_index_by_name :taggings, :i_taggings_on_taggable_bigint_and_taggable_type_and_context + + unprepare_async_index_by_name :taggings, :i_taggings_on_taggable_id_convert_to_bigint_and_taggable_type + + unprepare_async_index_by_name :taggings, :index_taggings_on_id_convert_to_bigint + end +end |