diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-17 21:14:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-17 21:14:29 +0300 |
commit | 55bc011bc0f9e6102732d2694735a546738d6c5f (patch) | |
tree | 62656acd9ebcd542c395639fb0b8c015715777c7 /db | |
parent | 2a6300a15aa3e96cdcb2d5efc22c00255d246afd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20230403190527_add_index_to_security_scans_on_scan_type.rb | 18 | ||||
-rw-r--r-- | db/schema_migrations/20230403190527 | 1 | ||||
-rw-r--r-- | db/structure.sql | 2 |
3 files changed, 21 insertions, 0 deletions
diff --git a/db/post_migrate/20230403190527_add_index_to_security_scans_on_scan_type.rb b/db/post_migrate/20230403190527_add_index_to_security_scans_on_scan_type.rb new file mode 100644 index 00000000000..b8a377e833c --- /dev/null +++ b/db/post_migrate/20230403190527_add_index_to_security_scans_on_scan_type.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexToSecurityScansOnScanType < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + TABLE_NAME = :security_scans + INDEX_NAME = 'index_for_security_scans_scan_type' + SUCCEEDED = 1 + + def up + add_concurrent_index TABLE_NAME, [:scan_type, :project_id, :pipeline_id], where: "status = #{SUCCEEDED}", + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end +end diff --git a/db/schema_migrations/20230403190527 b/db/schema_migrations/20230403190527 new file mode 100644 index 00000000000..290c9c39333 --- /dev/null +++ b/db/schema_migrations/20230403190527 @@ -0,0 +1 @@ +0715accd97005c76bcb1e975bf00fd5fd4f34375a5d5a4131d107f13b1cd6be0
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 892a39ee338..ac29ad2625f 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -30616,6 +30616,8 @@ CREATE UNIQUE INDEX index_feature_gates_on_feature_key_and_key_and_value ON feat CREATE UNIQUE INDEX index_features_on_key ON features USING btree (key); +CREATE INDEX index_for_security_scans_scan_type ON security_scans USING btree (scan_type, project_id, pipeline_id) WHERE (status = 1); + CREATE INDEX index_for_status_per_branch_per_project ON merge_trains USING btree (target_project_id, target_branch, status); CREATE INDEX index_fork_network_members_on_fork_network_id ON fork_network_members USING btree (fork_network_id); |