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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20221021160735_add_index_for_common_finder_query_desc_with_namespace_id.rb')
-rw-r--r--db/post_migrate/20221021160735_add_index_for_common_finder_query_desc_with_namespace_id.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/db/post_migrate/20221021160735_add_index_for_common_finder_query_desc_with_namespace_id.rb b/db/post_migrate/20221021160735_add_index_for_common_finder_query_desc_with_namespace_id.rb
new file mode 100644
index 00000000000..d7c50010b72
--- /dev/null
+++ b/db/post_migrate/20221021160735_add_index_for_common_finder_query_desc_with_namespace_id.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexForCommonFinderQueryDescWithNamespaceId < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'index_group_vulnerability_reads_common_finder_query_desc'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :vulnerability_reads,
+ [:namespace_id, :state, :report_type, :severity, :vulnerability_id],
+ name: INDEX_NAME,
+ order: { severity: :desc, vulnerability_id: :desc }
+ end
+
+ def down
+ remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME
+ end
+end