Swap bigint columns for ci_sources_pipelines
What does this MR do and why?
This is the swap step of converting the ci_sources_pipelines columns id, project_id, and source_project_id from integer to bigint. It swaps the columns with their *_convert_to_bigint counterparts.
It adds one post-deployment migration, db/post_migrate/20260817155912_swap_columns_for_ci_sources_pipelines_bigint_conversion.rb, milestone 19.4.
What the migration does
Before the transaction, it recreates the bigint primary key index with the add_bigint_column_indexes helper, in case that index was dropped. This is the same helper the earlier index-duplication migration used, so the name and options match. The call is idempotent and skips creation when the index already exists.
Inside a lock-retried transaction it:
- swaps each integer column with its
*_convert_to_bigintcounterpart - swaps the column defaults
- resets the trigger functions
- swaps the primary key constraint
ci_sources_pipelines_pkey - swaps the indexes
index_ci_sources_pipelines_on_project_idandindex_ci_sources_pipelines_on_source_project_id
There are no foreign keys on the converted columns, and no foreign keys from other tables point at this table's id. So there is no foreign key swap.
db/structure.sql is not changed on purpose. On new installations these columns are already bigint, so skip_bigint_migration? returns true and the migration does nothing.
Ordering
The bigint indexes must exist in production before the swap runs. Those indexes shipped in !242049 (merged), which merged for 19.3. This swap targets 19.4, the next release, so the indexes are already deployed.
This MR was a draft waiting on that, and it was stacked on the branch of !242049 (merged). It now targets master directly and contains only the swap migration.
Database testing
The db:gitlabcom-database-testing job needs to run before database review.
Related
- Work item: #500027 (closed)
- Index duplication (merged): !242049 (merged)
- Epic: &15621