Remove NOT NULL constraint from ci_runner_taggings.tag_id column
NOTE: This issue will only be implemented if we don't implement the trigger solution in #583610
Summary
Remove the NOT NULL constraint from the tag_id column in the ci_runner_taggings table to support the OrgMover workflow.
NOTE: This will only be needed if we don't implement a trigger in #583610
Background
As discussed in #470872 (comment 2946286692):
The tag_id column needs to be nullable so it can be nullified upon organization migration. When OrgMover moves data between cells:
- The
tag_idwill not be migrated (nullified) - The
tag_idwill be reconstructed on the target cell from thenamecolumn to deduplicate against the cell-localtagstable - The
tag_namecolumn serves as the source of truth for tag data, whiletag_idis an acceleration/deduplication field
This aligns with the design outlined in #470872 (comment 2382060671):
We add
ci_runner_taggingswithnameandtag_id... When OrgMoving we do not migratetag_id, this will be reconstructed later to deduplicate cell-local.
Implementation
- Create a migration to remove the
NOT NULLconstraint fromci_runner_taggings.tag_id - Update any application code that assumes
tag_idis always present - Ensure the reconstruction logic can handle null
tag_idvalues and populate them from thetag_namecolumn
Related Issues
- Parent issue: #470872
Edited by Pedro Pombeiro