Re-add unique index_tags_on_name index
What does this MR do and why?
This MR re-adds the unique index_tags_on_name
index, as apparently some installations don't have this index (see omnibus-gitlab#8579 (comment 1947034496) and #433256 (comment 1921833690)). It follows the same approach as !152360 (merged) to fix this particular deviation from the intended schema.
Normally, this will be a no-op. In the event that the unique index does not exist, it gets created. If duplicate values exist, we point the user to a thread that will help it remove the duplicates, so that the index can be created.
Closes #433256
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
In the ci database, drop the
index_tags_on_name
index:DROP INDEX index_tags_on_name;
-
Create a duplicate value in the tags table, e.g.:
INSERT INTO tags (name) VALUES ('runner-fleet')
-
Run the migration.
-
Notice the error message.
-
Delete the duplicate row from the
tags
table -
Drop the invalid
index_tags_on_name
index:DROP INDEX index_tags_on_name;
-
Run the migration again, this time it should finish successfully.