Bigint migration for deployment_clusters

What does this MR do and why?

Bigint migration for deployment_clusters

This MR

  1. Finalizes bigint conversion migration
  2. Adds new bigint indexes for columns
  3. Creates foreign key on deployments
  4. Validates foreign key for deployments

Changelog: added

References

Screenshots or screen recordings

Locally after async FK

gitlabhq_development=# \d+ deployment_clusters
                                                       Table "public.deployment_clusters"
             Column              |          Type          | Collation | Nullable | Default | Storage  | Compression | Stats target | Description 
---------------------------------+------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
 deployment_id                   | bigint                 |           | not null |         | plain    |             |              | 
 cluster_id                      | bigint                 |           | not null |         | plain    |             |              | 
 kubernetes_namespace            | character varying(255) |           |          |         | extended |             |              | 
 deployment_id_convert_to_bigint | bigint                 |           |          |         | plain    |             |              | 
 cluster_id_convert_to_bigint    | bigint                 |           |          |         | plain    |             |              | 
Indexes:
    "deployment_clusters_pkey" PRIMARY KEY, btree (deployment_id)
    "bigint_idx_335ba10ec2e6a3c06511" UNIQUE, btree (deployment_id_convert_to_bigint)
    "bigint_idx_9a932b5edac1f1a8a32a" btree (cluster_id_convert_to_bigint, kubernetes_namespace)
    "bigint_idx_ba404369e3293e400b8c" UNIQUE, btree (cluster_id_convert_to_bigint, deployment_id_convert_to_bigint)
    "idx_deployment_clusters_on_cluster_id_and_kubernetes_namespace" btree (cluster_id, kubernetes_namespace)
    "index_deployment_clusters_on_cluster_id_and_deployment_id" UNIQUE, btree (cluster_id, deployment_id)
Foreign-key constraints:
    "fk_rails_6359a164df" FOREIGN KEY (deployment_id) REFERENCES deployments(id) ON DELETE CASCADE
    "fk_rails_6359a164df_tmp" FOREIGN KEY (deployment_id_convert_to_bigint) REFERENCES deployments(id_convert_to_bigint) ON DELETE CASCADE
Access method: heap

How to set up and validate locally

https://docs.gitlab.com/development/database/foreign_keys/#test-database-fk-changes-locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #581428 (closed)

Edited by Max Fan

Merge request reports

Loading
Loading