Migrate `Deployments` and related Tables to BigInt
This Epic is to track all the BigInt migrations and tasks needed to migrate over the tables `Deployments` `DeploymentClusters` `DeploymentMergeRequests` https://docs.gitlab.com/development/database/avoiding_downtime_in_migrations/#migrating-integer-primary-keys-to-bigint --- Here is the proposed plan Table report sizes: https://console.postgres.ai/gitlab/gitlab_production/reports/219432/files/997918/md#postgres-checkup_L001 (we'll need to async `deployments` and `deployment_merge_requests`) ## `deployments` Sql structure: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/45252/commands/138774 Columns need to convert: `[id, project_id, environment_id, user_id]` - We'll need to split this into 2 stages to reduce WAL rate ### This is for `[id, environment_id]` columns (Phase One) 1. Initialize & create bigint columns (done already by Tiger) 2. Prepare Async Indexes 3. (the following week) Add indexes normally, add NOT VALID foreign keys, prepare async foreign key validation 4. (the following week after 3) Perform the swap, remove old indexes and foreign keys (async) ### This is for `[project_id, user_id]` columns (Phase Two) 1. Initialize & create bigint columns (done already by Tiger) 2. (the same week as step 4 above) Prepare Async Indexes 3. (the following week) Add indexes normally, add NOT VALID foreign keys, prepare async foreign key validation 4. (the following week after 3) Perform the swap, remove old indexes and foreign keys (async) ## `deployment_clusters` Sql structure: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/45316/commands/138970 Columns need to convert: `[deployment_id, cluster_id]` 1. Initialize & create bigint columns (done already by Tiger) 2. Prepare Async Indexes 1. I don't think we need this, the table size is only 2GB and far smaller than the other two 3. (the following week) Add indexes normally, add NOT VALID foreign keys, prepare async foreign key validation 4. (the following week after 3) Perform the swap, remove old indexes and foreign keys (async) ## `deployment_merge_requests` Sql structure: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/45316/commands/138975 Columns need to convert: `[deployment_id, merge_request_id, environment_id]` - Surprisingly `project_id` is not included here 1. Initialize & create bigint columns (done already by Tiger) 2. Prepare Async Indexes - (TBD) 3. (the following week) Add indexes normally, add NOT VALID foreign keys, prepare async foreign key validation 4. (the following week after 3) Perform the swap, remove old indexes and foreign keys (async)
epic