Add migration helpers for finalizing the conversion of a primary key from int to bigint
This issue follows the successful completion of #292841 (closed) and #288004 (closed)
In order to address the Primary Key overflow risk for tables with an integer PK, we need migration helpers that will allow us to convert a primary key and all the foreign keys that reference it from int to bigint.
The second step is to add migration helper(s) for finalizing the process and supporting some of the following operations:
- Clean up the background migrations
- Drop the
DEFAULT 0
from the affected columns - Concurrently add a Unique index for the new PK and indexes for any Foreign Keys that will reference it
- Concurrently add any additional indexes that include the columns
- Single Transaction: Drop old PK, define new PK, swap sequence, swap columns
- Single Transaction: Drop old FKs, define new FKs (as invalid), swap columns, validate FKs
Not all will be possible to be covered by a single migration helper and some of the operations (e.g. adding the new indexes concurrently) may require manual steps through separate migrations.
The migration helpers created in this issue will be used for finalizing the events.id
conversion to bigint (#288005 (closed))
Edited by Yannis Roussos