Skip to content
  • Bojan Marjanovic's avatar
    Add and backfill group_id for epic_user_mentions · 6115c124
    Bojan Marjanovic authored
    ## What does this MR do and why?
    
    Add and backfill group_id for epic_user_mentions.
    
    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/epic_user_mentions.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.com/ee/development/database/batched_background_m...
    6115c124