Skip to content

Convert events.id to bigint - Step 2: Finalize background migration and swap columns

events is the largest table in GitLab's database that is defined using an integer (int4) Primary Key.

With #288004 (closed) we have started the process of converting it to bigint (int8) type.

In this issue we'll address the second step of the process, for both push_event_payloads and events:

  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

Related Tracking Issue: #220023 (closed)

Previous Implementation Issue: #288004 (closed)

Edited by Krasimir Angelov