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

20220818140553_add_unique_index_to_sbom_occurrences_on_ingestion_attributes.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2538017e2871d58b568e75896f84cc1caabc5d34 (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 AddUniqueIndexToSbomOccurrencesOnIngestionAttributes < Gitlab::Database::Migration[2.0]
  INDEX_NAME = 'index_sbom_occurrences_on_ingestion_attributes'
  ATTRIBUTES = %i[
    project_id
    component_id
    component_version_id
    source_id
    commit_sha
  ].freeze

  disable_ddl_transaction!

  def up
    add_concurrent_index :sbom_occurrences, ATTRIBUTES, unique: true, name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :sbom_occurrences, name: INDEX_NAME
  end
end