Skip to content

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

  1. Add a validation for tag_name in the model to prevent records with nil attribute as now all existing and new records should be valid. (step 2.3 of Add a NOT NULL constraint to an existing column documentation)
  2. Create a post-deployment migration to add a NOT NULL constraint to ci_runner_taggings.tag_name (step 2.4 of Add a NOT NULL constraint to an existing column documentation)
  3. add_not_null_constraint might need to be used with validate: false depending on the performance of the operation. #573115 will deal with validation if necessary.
  4. Follow the standard GitLab migration practices for adding constraints

Related Issues