Commit ab6a20b5 authored by Patrick Bair's avatar Patrick Bair

Merge branch '227765_add_index_vulnerabilities_on_project_id_and_severity' into 'master'

Index vulnerabilities on project_id, state and severity columns

See merge request gitlab-org/gitlab!48930
parents 04070232 167040d8
---
title: Add index for the `vulnerabilities` table on `project_id`, `state`, and `severity`
columns
merge_request: 48930
author:
type: added
# frozen_string_literal: true
class AddIndexVulnerabilitiesOnProjectIdAndStateAndSeverity < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_vulnerabilities_on_project_id_and_state_and_severity'
disable_ddl_transaction!
def up
add_concurrent_index :vulnerabilities, [:project_id, :state, :severity], name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME
end
end
# frozen_string_literal: true
class DropIndexVulnerabilitiesOnProjectId < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_vulnerabilities_on_project_id'
disable_ddl_transaction!
def up
remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME
end
def down
add_concurrent_index :vulnerabilities, :project_id, name: INDEX_NAME
end
end
54ed18361a28d0b750cbbdb3bfb53b7e4bbe3d1d7264de51522796d3bd15f7a5
\ No newline at end of file
cb11dc9996b1706feaa8a53f96cbaa6209a4d07b3be9e88ebc3d1e1ada561287
\ No newline at end of file
......@@ -22557,7 +22557,7 @@ CREATE INDEX index_vulnerabilities_on_last_edited_by_id ON vulnerabilities USING
CREATE INDEX index_vulnerabilities_on_milestone_id ON vulnerabilities USING btree (milestone_id);
CREATE INDEX index_vulnerabilities_on_project_id ON vulnerabilities USING btree (project_id);
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);
......
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