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

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

class PrepareIndexOnVulnerabilityOccurrencesUuidIncludingVulnerabilityIdAsync < Gitlab::Database::Migration[2.1]
  INDEX_NAME = "index_vuln_findings_on_uuid_including_vuln_id_1"

  def up
    index_sql = <<~SQL
      CREATE UNIQUE INDEX CONCURRENTLY #{INDEX_NAME}
      ON vulnerability_occurrences(uuid_convert_string_to_uuid)
      INCLUDE(vulnerability_id)
    SQL

    prepare_async_index_from_sql(index_sql)
  end

  def down
    unprepare_async_index_by_name(
      :vulnerability_occurrences,
      INDEX_NAME
    )
  end
end