Add organization_id column to runner tables
As decided in #470872 (comment 2382046293), we'll replace sharding_key_id by organization_id. The first step will be to add the column to the following tables: ci_runners, ci_runner_machines, and ci_runner_taggings (both non-partitioned and partitioned versions).
Follow instructions in documentation.
-
Release N.M:
- Column will be added as nullable to account for instance runners. We'll need to backfill group and project runners later on.
- Add index for
organization_id:index_ci_runners_on_organization_id_when_not_null" btree (organization_id) WHERE organization_id IS NOT NULL - Add LFK to
organizationstable - Add logic to populate
organization_idin models.
-
Release N.M+1:
- Add logic to validate
organization_idin models. - Add PDM with check constraint for
organization_idnullness depending onrunner_type(similar tocheck_sharding_key_id_nullness)
Examples: Ci::Runner#ensure_manager, Ci::Runner sharding_key_id validations, Ci::RunnerManager sharding_key_id validations, Ci::RunnerTagging sharding_key_id validation, Ci::Runners::RegisterRunnerService#attrs_from_token.
- Add logic to validate
Edited by Pedro Pombeiro