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

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

class ReplaceSbomOccurrencesComponentIdIndex < Gitlab::Database::Migration[2.1]
  REMOVED_INDEX_NAME = "index_sbom_occurrences_on_component_id"
  ADDED_INDEX_NAME = "index_sbom_occurrences_on_component_id_and_id"

  disable_ddl_transaction!

  def up
    add_concurrent_index :sbom_occurrences, %i[component_id id], name: ADDED_INDEX_NAME
    remove_concurrent_index_by_name :sbom_occurrences, name: REMOVED_INDEX_NAME
  end

  def down
    add_concurrent_index :sbom_occurrences, :component_id, name: REMOVED_INDEX_NAME
    remove_concurrent_index_by_name :sbom_occurrences, name: ADDED_INDEX_NAME
  end
end