Skip to content

Prepare indexes for bigint p_ci_builds

Problem

This column references the ci_pipelines table and its column type is not bigint.

Process

This is part of the process to convert the column to bigint.

To be able to replicate the foreign key constraints, We will need to replicate the following indexes for the new bigint columns:

  • p_ci_builds.auto_canceled_by_id_convert_to_bigint
  • p_ci_builds.commit_id_convert_to_bigint
  • p_ci_builds.erased_by_id_convert_to_bigint
  • p_ci_builds.project_id_convert_to_bigint
  • p_ci_builds.runner_id_convert_to_bigint
  • p_ci_builds.trigger_request_id_convert_to_bigint
  • p_ci_builds.upstream_pipeline_id_convert_to_bigint
  • p_ci_builds.user_id_convert_to_bigint

Indexes:

  • p_ci_builds_auto_canceled_by_id_idx
  • p_ci_builds_commit_id_artifacts_expire_at_id_convert_to_big_idx
  • p_ci_builds_commit_id_stage_idx_created_at_idx
  • p_ci_builds_commit_id_status_type_idx
  • p_ci_builds_commit_id_type_name_ref_idx
  • p_ci_builds_commit_id_type_ref_idx
  • p_ci_builds_project_id_id_convert_to_bigint_idx
  • p_ci_builds_project_id_name_ref_idx
  • p_ci_builds_project_id_status_idx
  • p_ci_builds_status_created_at_project_id_idx
  • p_ci_builds_runner_id_id_convert_to_bigint_idx
  • p_ci_builds_runner_id_idx
  • p_ci_builds_status_type_runner_id_idx
  • p_ci_builds_upstream_pipeline_id_idx
  • p_ci_builds_user_id_created_at_idx
  • p_ci_builds_user_id_idx
  • p_ci_builds_user_id_name_created_at_idx
  • p_ci_builds_user_id_name_idx

Follow the instruction, and choose to add indexes concurrently or asynchronously based on the table size and the migration time.

Edited by Tianwen Chen