Add organization_id to sbom_component_versions

What does this MR do and why?

  • Add organization_id column to sbom_component_versions table.
  • Make organization_id the sharding key for sbom_component_versions to support Cells.
  • Declare organization_id as a loose foreign key to support gitlab_sec decomposition
  • Change the ingestion task for Sbom::ComponentVersion models to set the organization_id upon ingestion.

It's not necessary to replace to add organization_id to the unique index on (component_id, version). That's because components referenced by the component_id foreign key are already local to an organization. See #469435 (comment 2092272041)

Related to #469435 (closed)

Edited by Fabien Catteau

Merge request reports

Loading