diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-27 21:09:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-27 21:09:04 +0300 |
commit | 7424d727b85dc0ac19544020a092f462a894a7df (patch) | |
tree | 88e0cc41297973c1082f0aff14925a6fbd27823f /db | |
parent | 0847321aeec58e8885c18b64abd6732581ec33a4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20230626101519_create_index_for_vulnerability_reads_on_common_project_filters.rb | 18 | ||||
-rw-r--r-- | db/schema_migrations/20230626101519 | 1 | ||||
-rw-r--r-- | db/structure.sql | 2 |
3 files changed, 21 insertions, 0 deletions
diff --git a/db/post_migrate/20230626101519_create_index_for_vulnerability_reads_on_common_project_filters.rb b/db/post_migrate/20230626101519_create_index_for_vulnerability_reads_on_common_project_filters.rb new file mode 100644 index 00000000000..209a2295f22 --- /dev/null +++ b/db/post_migrate/20230626101519_create_index_for_vulnerability_reads_on_common_project_filters.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class CreateIndexForVulnerabilityReadsOnCommonProjectFilters < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + INDEX_NAME = 'index_project_vulnerability_reads_common_finder_query_desc' + + def up + add_concurrent_index :vulnerability_reads, + [:project_id, :state, :report_type, :severity, :vulnerability_id], + order: { severity: :desc, vulnerability_id: :desc }, + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME + end +end diff --git a/db/schema_migrations/20230626101519 b/db/schema_migrations/20230626101519 new file mode 100644 index 00000000000..874d3eec0ee --- /dev/null +++ b/db/schema_migrations/20230626101519 @@ -0,0 +1 @@ +7060d1ed7be6fce2e398d9ac042d6e67826742e639df8eee43245d66b8b87ea3
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 7368b3a76de..09709075788 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -32410,6 +32410,8 @@ CREATE INDEX index_project_topics_on_topic_id ON project_topics USING btree (top CREATE UNIQUE INDEX index_project_user_callouts_feature ON user_project_callouts USING btree (user_id, feature_name, project_id); +CREATE INDEX index_project_vulnerability_reads_common_finder_query_desc ON vulnerability_reads USING btree (project_id, state, report_type, severity DESC, vulnerability_id DESC); + CREATE UNIQUE INDEX index_project_wiki_repositories_on_project_id ON project_wiki_repositories USING btree (project_id); CREATE INDEX index_projects_aimed_for_deletion ON projects USING btree (marked_for_deletion_at) WHERE ((marked_for_deletion_at IS NOT NULL) AND (pending_delete = false)); |