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

20230727103144_add_prepared_at_created_at_index.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 44c293bca2acb7f00c038c4f418455ff594a2765 (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 AddPreparedAtCreatedAtIndex < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  INDEX_NAME = 'index_merge_requests_id_created_at_prepared_at'

  # TODO: Issue for sync deletion: https://gitlab.com/gitlab-org/gitlab/-/issues/419918

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

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