Commit cd9b0432 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch...

Merge branch '345905-cluster-image-scanning-vulnerability-resolution-partial-index-for-resolution' into 'master'

Add partial index for active Cluster Image Scanning vulnerabilities

See merge request gitlab-org/gitlab!80300
parents b8851eb8 286352f1
# frozen_string_literal: true
class AddPartialIndexForBatchingActiveClusterImageScanningVulnerabilities < Gitlab::Database::Migration[1.0]
INDEX_NAME = 'index_vulnerabilities_on_project_id_and_id_active_cis'
INDEX_FILTER_CONDITION = 'report_type = 7 AND state = ANY(ARRAY[1, 4])'
disable_ddl_transaction!
def up
add_concurrent_index :vulnerabilities, [:project_id, :id], where: INDEX_FILTER_CONDITION, name: INDEX_NAME
end
def down
remove_concurrent_index :vulnerabilities, [:project_id, :id], name: INDEX_NAME
end
end
9462258bcbe45ab80f7ef5a02f8b8d5c0ed6ac69bf04b8934ae3dee2261ba458
\ No newline at end of file
......@@ -28144,6 +28144,8 @@ CREATE INDEX index_vulnerabilities_on_milestone_id ON vulnerabilities USING btre
CREATE INDEX index_vulnerabilities_on_project_id_and_id ON vulnerabilities USING btree (project_id, id);
CREATE INDEX index_vulnerabilities_on_project_id_and_id_active_cis ON vulnerabilities USING btree (project_id, id) WHERE ((report_type = 7) AND (state = ANY (ARRAY[1, 4])));
CREATE INDEX index_vulnerabilities_on_project_id_and_state_and_severity ON vulnerabilities USING btree (project_id, state, severity);
CREATE INDEX index_vulnerabilities_on_resolved_by_id ON vulnerabilities USING btree (resolved_by_id);
......@@ -29,7 +29,7 @@ RSpec.describe Vulnerability do
let_it_be(:vulnerability) { create(:vulnerability, :sast, :confirmed, :low, project: project) }
let_it_be(:finding) { create(:vulnerabilities_finding, vulnerability: vulnerability) }
it { is_expected.to have_locked_schema('f2d19034bdc7733dad8451dbb26250298f7de27895e99a2a0932f6d728f3cc27').reference('https://gitlab.com/gitlab-org/gitlab/-/issues/349315') }
it { is_expected.to have_locked_schema('1128736d19b1457375faecb3bf8017350431dbbca91222c8edfcfa7c649638fb').reference('https://gitlab.com/gitlab-org/gitlab/-/issues/349315') }
describe 'enums' do
it { is_expected.to define_enum_for(:state).with_values(state_values) }
......
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