Commit 99471d01 authored by Toon Claes's avatar Toon Claes

Merge branch 'add_deduplicated_column_to_security_findings' into 'master'

Add deduplicated column to security findings and arrange indices

See merge request gitlab-org/gitlab!42270
parents 824ca5c1 97520df2
---
title: Add `deduplicated` column to `security_findings` table along with the compound
index on `scan_id` and `deduplicated` and remove the index on `scan_id`
merge_request: 42270
author:
type: added
# frozen_string_literal: true
class AddDeduplicatedFlagIntoSecurityFindingsTable < ActiveRecord::Migration[6.0]
DOWNTIME = false
def change
add_column :security_findings, :deduplicated, :boolean, default: false, null: false
end
end
# frozen_string_literal: true
class AddIndexOnDeduplicatedColumnOfSecurityFindings < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_security_findings_on_scan_id_and_deduplicated'
disable_ddl_transaction!
def up
add_concurrent_index :security_findings, [:scan_id, :deduplicated], name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :security_findings, INDEX_NAME
end
end
# frozen_string_literal: true
class RemoveIndexOnSecurityFindingsScanId < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_security_findings_on_scan_id'
disable_ddl_transaction!
def up
remove_concurrent_index_by_name :security_findings, INDEX_NAME
end
def down
add_concurrent_index :security_findings, :scan_id, name: INDEX_NAME
end
end
0b01a251eb736eb9e9986214c69ea5f4a11d8293bc4083af1585ce265c8f69de
\ No newline at end of file
570a7de82da3dabfd12f3099cdc028128d4b61a4ecf6edd4b3102031d914316c
\ No newline at end of file
dcfd1f006aa6695e0fd8f392c7288f2d80bddfe53827d3a2f079bd039f4fe0de
\ No newline at end of file
...@@ -15495,6 +15495,7 @@ CREATE TABLE public.security_findings ( ...@@ -15495,6 +15495,7 @@ CREATE TABLE public.security_findings (
severity smallint NOT NULL, severity smallint NOT NULL,
confidence smallint NOT NULL, confidence smallint NOT NULL,
project_fingerprint text NOT NULL, project_fingerprint text NOT NULL,
deduplicated boolean DEFAULT false NOT NULL,
CONSTRAINT check_b9508c6df8 CHECK ((char_length(project_fingerprint) <= 40)) CONSTRAINT check_b9508c6df8 CHECK ((char_length(project_fingerprint) <= 40))
); );
...@@ -21016,7 +21017,7 @@ CREATE INDEX index_security_findings_on_confidence ON public.security_findings U ...@@ -21016,7 +21017,7 @@ CREATE INDEX index_security_findings_on_confidence ON public.security_findings U
CREATE INDEX index_security_findings_on_project_fingerprint ON public.security_findings USING btree (project_fingerprint); CREATE INDEX index_security_findings_on_project_fingerprint ON public.security_findings USING btree (project_fingerprint);
CREATE INDEX index_security_findings_on_scan_id ON public.security_findings USING btree (scan_id); CREATE INDEX index_security_findings_on_scan_id_and_deduplicated ON public.security_findings USING btree (scan_id, deduplicated);
CREATE INDEX index_security_findings_on_scanner_id ON public.security_findings USING btree (scanner_id); CREATE INDEX index_security_findings_on_scanner_id ON public.security_findings USING btree (scanner_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment