Skip to content
  • Bojan Marjanovic's avatar
    Add and backfill project_id for sbom_occurrences_vulnerabilities · 225de1c9
    Bojan Marjanovic authored
    ## What does this MR do and why?
    
    Add and backfill project_id for sbom_occurrences_vulnerabilities.
    
    This table has a
    [desired sharding key](https://docs.gitlab.com/ee/development/database/multiple_databases.html#define-a-desired_sharding_key-to-automatically-backfill-a-sharding_key)
    configured ([view configuration](https://gitlab.com/gitlab-org/gitlab/-/blob/master/db/docs/sbom_occurrences_vulnerabilities.yml)).
    
    This merge request is the first step towards transforming the desired sharding key into a
    [sharding key](https://docs.gitlab.com/ee/development/database/multiple_databases.html#defining-a-sharding-key-for-all-cell-local-tables).
    
    This involves three changes:
    
    - Adding a new column that will serve as the sharding key (along with the relevant index and foreign key).
    - Populating the sharding key when new records are created by adding a database function and trigger.
    - Scheduling a [batched background migration](https://docs.gitlab.co...
    225de1c9