Skip to content

Add sharding_key_id to ci_runners table

🚨 NOTE: There is urgency in getting !167389 (merged) and this MR merged soon, since they unblock batched background migrations that must make it to %17.5 (which is a required stop), so we can finalize them in %17.6 🚨

What does this MR do and why?

The changes in this MR are needed because in !166308, we'll be creating a partitioned copy of the table with an automated trigger to copy data from ci_runners to the partitioned table. If we don't have all the required columns, the check constraint will fail on the target table.

This MR:

  • Adds a sharding_key_id column to the ci_runners table.
  • Adds logic to populate sharding_key_id when a runner is created, registered, or reassigned to a different owner project.
  • Adds a post-deployment migration to backfill the field from ci_runner_namespaces and ci_runner_projects.

Changelog: added

Part of #493256 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

n/a

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

n/a

Edited by Pedro Pombeiro

Merge request reports

Loading