Migrate duplicate push_rules to project_push_rules

What does this MR do and why?

This MR migrates duplicate push_rules to project_push_rules using environment-specific logic:

  • GitLab.com: Selects duplicate with lowest ID (MIN) to match order(:id) behavior when push_rule_ordered_by_id feature flag is enabled
  • Self-managed: Uses LIMIT 1 without ORDER BY to preserve implicit database ordering that customers have been relying on

This maintains consistency with existing project.push_rule association behavior across different environments.

Query Plans

References

Screenshots or screen recordings

Before After

How to set up and validate locally

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 #499156

Edited by Olaoluwa Oluro

Merge request reports

Loading