Write plan_name_uid columns on create/update

Part 1 of transitioning from plan_id to plan_name_uid associations.

What this does

This MR implements automatic syncing of *_plan_name_uid columns during create and update operations for:

  • PlanLimits
  • GitlabSubscription
  • Ci::Runner (allowed_plan_name_uids)
  • Ci::PendingBuild

When a plan_id is set or changed, the corresponding *_plan_name_uid column is automatically populated with the associated plan's name_uid.

Context

Issue: #571421 (closed)

The columns were added in !213444 (merged).

Note: This was originally merged in !215322 (merged) but had to be reverted due to FOSS pipeline failure from using EE factories in CE specs. The issues have been addressed in the latest commit of this MR.

Migration plan

  • Part 1 (this MR): Write to new columns
  • Part 2: Backfill existing data
  • Part 3: Switch reads to use the new columns

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 Ryan Cobb

Merge request reports

Loading