Add foreign key for ci_runner_taggings.tag_id
What does this MR do and why?
This MR adds a validated foreign key constraint for ci_runner_taggings.tag_id.
Changelog: other
I think we can skip a migration to delete taggings from non-existent tags, since there are no such occurrences in prod (we have a belongs_to relationship between models enforcing referential integrity at the application level, and also an LFK in place):
gitlabhq_dblab> SELECT tag_id FROM ci_runner_taggings WHERE NOT EXISTS (SELECT 1 AS one FROM tags WHERE id = tag_id)
+--------+
| tag_id |
|--------|
+--------+
SELECT 0
References
Add foreign key constraint from ci_runner_taggi... (#566249 - closed)
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 Pedro Pombeiro