summaryrefslogtreecommitdiff
path: root/db/post_migrate/20230511132140_create_component_id_index.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-16 09:08:02 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-16 09:08:02 +0000
commit613868af23d7c0e09210857518895edd6678f5e9 (patch)
tree90b5ba583bbec4cb2a1eef3b34b2df1bb13de50f /db/post_migrate/20230511132140_create_component_id_index.rb
parentb78b8c1103e1e9542891a1c333c8abcd4d7e10ab (diff)
downloadgitlab-ce-613868af23d7c0e09210857518895edd6678f5e9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/post_migrate/20230511132140_create_component_id_index.rb')
-rw-r--r--db/post_migrate/20230511132140_create_component_id_index.rb17
1 files changed, 17 insertions, 0 deletions
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