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
:
- Ensure background migrations are competed.
- Create indexes and FKs using the new columns.
- In a single transaction, swap columns:
- Swap column names
- Update rename trigger function
- Swap defaults
- Swap PK constraint
- Rename the rest of the indexes
- Rename FKs
Additional required steps once the switch is done:
- Remove rename triggers
- Remove
integer
columns - 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) - Remove the temporary columns from ignored columns
Related Tracking Issue: #220023 (closed)
Previous Implementation Issue: #288004 (closed)
Edited by Krasimir Angelov