From 613868af23d7c0e09210857518895edd6678f5e9 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 16 May 2023 09:08:02 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../20230511132140_create_component_id_index.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 db/post_migrate/20230511132140_create_component_id_index.rb (limited to 'db/post_migrate') diff --git a/db/post_migrate/20230511132140_create_component_id_index.rb b/db/post_migrate/20230511132140_create_component_id_index.rb new file mode 100644 index 00000000000..3b466010f7c --- /dev/null +++ b/db/post_migrate/20230511132140_create_component_id_index.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class CreateComponentIdIndex < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_sbom_occurrences_on_project_id_component_id' + + def up + return if index_exists_by_name?(:sbom_occurrences, INDEX_NAME) + + add_concurrent_index :sbom_occurrences, [:project_id, :component_id], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :sbom_sources, INDEX_NAME + end +end -- cgit v1.2.1