Skip to content

Enqueue migration to delete orphaned pipeline variables rows

Similar to https://gitlab.com/gitlab-org/gitlab/-/issues/485607k, the corrupted foreign key between p_ci_pipelines and p_ci_pipeline_variables left orphaned variable records in the database and they need to be removed before validating the new foreign key between these tables.

Specifically, we have a bit over 1M rows to remove:

gitlabhq_dblab=# select count(*) from p_ci_pipeline_variables where not exists(select 1 from ci_pipelines where ci_pipelines.id = p_ci_pipeline_variables.pipeline_id);
  count
---------
 1021483
(1 row)