Skip to content

Convert ci_build_needs.build_id to bigint - Step 2: Finalize background migrations and swap columns

With #328044 (closed) we have started the process of converting the foreign key from ci_build_needs that references ci_builds (ci_build_needs.build_id) to bigint (int8).

In this issue we'll address the second step of the process for ci_build_needs:

  1. Ensure background migrations are competed.
  2. Create indexes and FKs using the new columns.
  3. In a single transaction, swap columns:
    1. Swap column names
    2. Update rename trigger function
    3. Swap defaults
    4. Swap PK constraint
    5. Rename the rest of the indexes
    6. Rename FKs

Additional required steps once the switch is done:

  1. Remove rename triggers
  2. Remove integer columns
  3. Remove the temporary columns from the IMPORT_EXPORT_CONFIG: lib/gitlab/import_export/project/import_export.yml (related comment in the MR that introduced the change)
  4. Remove the temporary columns from ignored columns
Edited by Krasimir Angelov