Remove auto-increment from plan id
What does this MR do and why?
This is an alternative solution for making the plans table protocell ready. While we will still most likely move towards using FixedItem model, if we go with this MR's approach, we won't be under the same time pressures.
Why This Is Safe
- Production (GitLab.com): All plans already exist, never recreated
-
Self-managed: Only uses
defaultplan (rarely created) - New Cells: Copy plans table from legacy cell during setup
-
Race conditions: Handled by unique constraint +
safe_find_or_create_by
Benefits
- Minimal code changes (~10 lines)
- No data migration needed
- Easy rollback (just restore the sequence default)
- Ensures consistent plan IDs across all Cells
Risks
- Minimal: Plans are rarely created (only during initial setup)
- Handled: Any race condition fails safely with unique constraint violation
References
- Protocells Dependency Reporting - Provision (gitlab-com/gl-infra&1726)
- Remove Auto-increment Sequence from Plans Table (#571927)
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.
Edited by Ryan Cobb