Make ci_runner_taggings.tag_name column non-nullable
Summary
Make the ci_runner_taggings.tag_name column non-nullable after the backfill migration from #570217 (closed) has been finalized.
Context
This is part of the work to handle FKs from ci_runner_taggings to tags as tracked in #467664.
The tag_name column was added and backfilled in 18.5. Now that the 18.5 required stop has passed, we can safely make this column non-nullable.
Implementation
- Add a validation for
tag_namein the model to prevent records with nil attribute as now all existing and new records should be valid. (step 2.3 ofAdd a NOT NULL constraint to an existing columndocumentation) - Create a post-deployment migration to add a
NOT NULLconstraint toci_runner_taggings.tag_name(step 2.4 ofAdd a NOT NULL constraint to an existing columndocumentation) -
add_not_null_constraintmight need to be used withvalidate: falsedepending on the performance of the operation. #573115 will deal with validation if necessary. - Follow the standard GitLab migration practices for adding constraints
Related Issues
- Parent: #467664
- Backfill: #570217 (closed)
- Sub-issues: #549027, #549028
Edited by Pedro Pombeiro - OOO from Oct 13-24