Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20210804153307_prepare_indexes_for_tagging_bigint_conversion.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 98f90bafce3486cb0cb44f18b94b2a9ec8930daf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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