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

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

class AsyncCreateSupportingIndexForFindingIdBackfill < Gitlab::Database::Migration[2.2]
  milestone '16.7'

  INDEX_NAME = "tmp_index_vulnerabilities_on_id_finding_id_empty"

  # TODO: Index to be created synchronously in https://gitlab.com/gitlab-org/gitlab/-/issues/433253
  def up
    prepare_async_index(
      :vulnerabilities,
      :id,
      where: "finding_id IS NULL",
      name: INDEX_NAME
    )
  end

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