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

20230629024403_events_bigint_create_indexe_async_for_gitlab_dot_com.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 13691034fd7d00c42ffe17eec04a390fedaac94a (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
# frozen_string_literal: true

class EventsBigintCreateIndexeAsyncForGitlabDotCom < Gitlab::Database::Migration[2.1]
  include Gitlab::Database::MigrationHelpers::ConvertToBigint

  def up
    return unless should_run?

    prepare_async_index :events,
      [:target_type, :target_id_convert_to_bigint, :fingerprint],
      name: :index_events_on_target_type_and_target_id_bigint_fingerprint,
      unique: true
  end

  def down
    return unless should_run?

    unprepare_async_index :events,
      [:target_type, :target_id_convert_to_bigint, :fingerprint],
      name: :index_events_on_target_type_and_target_id_bigint_fingerprint
  end

  private

  def should_run?
    com_or_dev_or_test_but_not_jh?
  end
end