Geo: Add unique constraint to registry foreign keys
There are a number of registry tables which do not have a uniqueness constraint on their foreign keys:
-
container_repository_registry -
job_artifact_registry -
merge_request_diff_registry -
package_file_registry -
terraform_state_version_registry
Adding the uniqueness constraints would reduce the risk of bad data.
Proposal
-
Add post migrations deleting duplicate rows in the affected tables -
Add post migrations adding the new indexes with the uniqueness constraint (with a different name?) -
Add post migrations removing the existing non-unique foreign key indexes -
Add unique: true
where needed in the doc https://docs.gitlab.com/ee/development/geo/framework.html => Opened !51185 (merged)
Edited by Valery Sizov