Commit eb3cd8bf authored by Tiger Watson's avatar Tiger Watson

Merge branch 'make_the_project_id_index_unique_on_vulnerability_statistics_table' into 'master'

Change the project_id index to be unique on vulnerability_statistics

See merge request gitlab-org/gitlab!35861
parents 0cf7e6bb 501b646f
# frozen_string_literal: true
class ChangeProjectIdIndexToBeUniqueOnVulnerabilityStatisticsTable < ActiveRecord::Migration[6.0]
DOWNTIME = false
INDEX_NAME = 'index_vulnerability_statistics_on_unique_project_id'
def up
remove_index :vulnerability_statistics, :project_id # rubocop:disable Migration/RemoveIndex (table is empty)
add_index :vulnerability_statistics, :project_id, name: INDEX_NAME, unique: true # rubocop:disable Migration/AddIndex (table is empty)
end
def down
remove_index :vulnerability_statistics, name: INDEX_NAME # rubocop:disable Migration/RemoveIndex (table is empty)
add_index :vulnerability_statistics, :project_id # rubocop:disable Migration/AddIndex (table is empty)
end
end
......@@ -20357,7 +20357,7 @@ CREATE UNIQUE INDEX index_vulnerability_scanners_on_project_id_and_external_id O
CREATE INDEX index_vulnerability_statistics_on_letter_grade ON public.vulnerability_statistics USING btree (letter_grade);
CREATE INDEX index_vulnerability_statistics_on_project_id ON public.vulnerability_statistics USING btree (project_id);
CREATE UNIQUE INDEX index_vulnerability_statistics_on_unique_project_id ON public.vulnerability_statistics USING btree (project_id);
CREATE UNIQUE INDEX index_vulnerability_user_mentions_on_note_id ON public.vulnerability_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL);
......@@ -23537,5 +23537,6 @@ COPY "schema_migrations" (version) FROM STDIN;
20200625190458
20200626060151
20200626130220
20200702123805
\.
---
title: Change the index on project_id column of vulnerability_statistics table to
be unique
merge_request: 35861
author:
type: changed
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