XS Add sharding key to ci_runner_projects (1 table)

The ci_runner_projects table has project_id, so runner_id can be associated with a project_id if they are Project-specific runners. But not all runners will be (e.g. instance runners).

Normally, this should be a simple case of adding

sharding_key:
  project_id: project

to db/docs/ci_runner_projects.yml, however the project_id column is nullable. Looking at gitlab.com, there are only 3 records in that situation:

image

Proposal

  1. Milestone N
    1. Add validations so that new invalid records cannot be created (!155756 (merged))
    2. Remove affected rows since they are not serving any purpose at this point (they are not connecting the runner to any project, given that project_id is null) (!155760 (merged))
  2. Milestone N + 1
    1. Follow the instructions to change the column to non-nullable.
    2. Add sharding key to db/docs/ci_runner_projects.yml
Edited by Pedro Pombeiro