Convert ci_job_artifacts.id to bigint - Step 2: Finalize background migrations and swap columns
The `ci_job_artifacts` table is one of the largest tables in GitLab's database still uses an integer (`int4`) Primary Key. It has a high Primary Key Overflow risk as can be seen on its [tracking issue](https://gitlab.com/gitlab-org/gitlab/-/issues/276019). With gitlab-org/gitlab#325614 we have started the process of converting it to `bigint` (`int8`) type. In this issue we'll address the second step of the process: * Clean up the background migrations * Drop the `DEFAULT 0` from the affected columns * Concurrently add a Unique index for the PK (`ci_job_artifacts_pkey`) * Concurrently add any additional indexes that include the converted columns ``` ci_job_artifacts: "expired_artifacts_temp_index" btree (id, created_at) WHERE expire_at IS NULL AND date(timezone('UTC'::text, created_at)) < '2020-06-22'::date "index_ci_job_artifacts_for_terraform_reports" btree (project_id, id) WHERE file_type = 18 "index_ci_job_artifacts_id_for_terraform_reports" btree (id) WHERE file_type = 18 "index_ci_job_artifacts_on_job_id_and_file_type" UNIQUE, btree (job_id, file_type) "index_ci_job_artifacts_on_expire_at_and_job_id" btree (expire_at, job_id) project_pages_metadata: "index_project_pages_metadata_on_artifacts_archive_id" btree (artifacts_archive_id) ``` * Single Transaction: Drop old PK, define new PK, swap sequence, swap columns * Single Transaction for each FK: Drop old FK, define new FK (as invalid), swap columns, validate FK * Drop the old columns Previous Implementation Issue: gitlab-org/gitlab#325614 Related Tracking Issue: gitlab-org/gitlab#276019
issue