Validate NOT NULL constraint on ci_runner_taggings.tag_name column
Summary
Validate the NOT NULL constraint on the ci_runner_taggings.tag_name column after it has been added in #573111.
Context
This is part of the work to handle FKs from ci_runner_taggings to tags as tracked in #467664.
Following GitLab's zero-downtime migration best practices, NOT NULL constraints are added in two steps:
- Add the constraint with
NOT VALID(#573111) - Validate the constraint (this issue) - checks all existing rows to ensure they comply
The validation step must be in a separate post-deployment migration to avoid long-running transactions and potential downtime.
Implementation
- Create a post-deployment migration to validate the NOT NULL constraint on
ci_runner_taggings.tag_name - Use
validate_not_null_constrainthelper method - This will check all existing rows without blocking writes
- Follow the standard GitLab migration practices for constraint validation
Prerequisites
-
NOT NULL constraint added with NOT VALID(#573111)
Related Issues
- Parent: #467664
- Add constraint: #573111
- Backfill: #570217 (closed)
Edited by Pedro Pombeiro