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

20230608145500_add_prepared_at_index_to_merge_requests.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3d3557ce543b8645b7a9f1e702d3e148711cc9c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

class AddPreparedAtIndexToMergeRequests < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  INDEX_NAME = 'index_merge_requests_on_id_and_prepared_at'

  # TODO: Index to be created synchronously in https://gitlab.com/gitlab-org/gitlab/-/issues/415721

  def up
    prepare_async_index(:merge_requests,
      :id,
      name: INDEX_NAME,
      where: "prepared_at IS NULL")
  end

  def down
    unprepare_async_index(:merge_requests, :id, name: INDEX_NAME)
  end
end