Skip to content

Address the Primary Key Overflow risk for the taggings table - Step 2: Finalize background migrations and swap columns

With #329536 (closed) we have started the process of converting taggings.id and taggings.taggable_id to bigint (int8).

taggings.id is the 7th table with the highest value for its PK (&4785 (closed)) and taggings.taggable_id indirectly references ci_builds (polymorphic association).

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

  1. Ensure the migration of taggings.id to id_convert_to_bigint is completed.
  2. Ensure the migration of taggings.taggable_id to taggable_id_convert_to_bigint is completed.
  3. Define any indexes over taggings.id and taggings.taggable_id for the new columns as well
  4. Define a unique index over taggings.id_convert_to_bigint
  5. Swap columns, drop existing PK, define new PK, swap sequences

The implementation should follow what we'll add for !64779 (merged), with only difference that we finalize and swap one additional column and there is no Foreign Key as this is a polymorphic association.

Edited by Yannis Roussos