Prepare issues bigint indexes batch one (free FK columns)

What does this MR do and why?

Schedules asynchronous creation of the first batch of bigint-equivalent indexes on the issues table, as part of the integer-to-bigint ID conversion tracked in #629827 (closed).

We batch the conversion by column: a column can only be swapped once all of its indexes exist on the bigint column, so every index that references a batch's columns is prepared in that batch.

Columns migrated in this batch

This batch covers the six single-column foreign-key columns that are not coupled to id:

  • closed_by_id
  • duplicated_to_id
  • last_edited_by_id
  • moved_to_id
  • promoted_to_epic_id
  • updated_by_id

id is not part of this batch. id co-occurs in composite indexes with project_id, milestone_id, and author_id, which couples those four columns into a single later batch (see the issue for the full plan).

Indexes prepared (original → bigint equivalent)

Original index Column
index_issues_on_closed_by_id closed_by_id
index_issues_on_duplicated_to_id duplicated_to_id
index_issues_on_last_edited_by_id last_edited_by_id
index_issues_on_moved_to_id moved_to_id
index_issues_on_promoted_to_epic_id promoted_to_epic_id
index_issues_on_updated_by_id updated_by_id

Indexes are prepared with prepare_async_index so they build during the weekend low-traffic window, following Create indexes asynchronously. Names use bigint_index_name(<original_index_name>) from Gitlab::Database::MigrationHelpers::ConvertToBigint, so the later swap migration can locate them.

Migration output

Post-deployment migration 20260821090000. It only inserts rows into postgres_async_indexes; the indexes are built later by the async index worker. db/structure.sql is unchanged for this reason. On instances without the conversion columns (for example, newer installs where all IDs are already bigint), the migration skips via its conversion_columns_exist? guard.

MR acceptance checklist

  • Applicable database review requested — this MR only schedules index preparation; no queries change.
Edited by Mario Celi

Merge request reports

Loading
Loading