Deduplicate project_group_links records

What does this MR do and why?

The project_group_links table should only contain unique pairs of group_id and project_id. This commit deduplicates the current records to prepare for adding a unique index on (group_id, project_id).

This change ensures data integrity by eliminating duplicate relationships between groups and projects.

References

Query plans

  1. https://console.postgres.ai/gitlab/gitlab-production-main/sessions/39508/commands/121553
  2. https://console.postgres.ai/gitlab/gitlab-production-main/sessions/39508/commands/121491

How to set up and validate locally

Run bin/rails db:migrate.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #535122 (closed)

Merge request reports

Loading