Backfill `project_id` for `dependency_list_exports`
Context: #434994 (comment 1779072112).
We need to define a sharding key for dependency_list_exports. An export can belong to a pipeline, project, group, or organization. Per defining a sharding key, we can have multiple sharding keys but we must have a check constraint ensuring that we have at least one of them.
Implementation plan
- Set
project_idtopipeline.project_idwhen creating pipeline dependency list exports - Backfill
project_idfor all existing exports which have apipeline_id
Verification
-
Make sure that dependency_list_exports.organization_idis set on rows wherepipeline_idis set. The following query shouldn't return any row.select * from dependency_list_exports where pipeline_id is not null and project_id is null;
Edited by Fabien Catteau