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

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

  INDEX_NAME = "index_vuln_findings_on_uuid_including_vuln_id_1"

  def up
    execute <<~SQL
      CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS #{INDEX_NAME}
      ON vulnerability_occurrences(uuid_convert_string_to_uuid)
      INCLUDE(vulnerability_id)
    SQL
  end

  def down
    remove_concurrent_index_by_name(
      :vulnerability_occurrences,
      INDEX_NAME
    )
  end
end