• Stan Hu's avatar
    Fix foreign key and index names in `ci_sources_pipelines` · 3fa6e65f
    Stan Hu authored
    When the `ci_sources_pipelines` table was first introduced in GitLab 9.3
    EE, the foreign key names generate for the table appeared to have been
    calculated via a hash using the table name
    `ci_pipeline_source_pipelines`. This led to a merge conflict and
    confusion during a CE to EE merge in GitLab 10.0, which regenerated the
    schema with the correct foreign key names.
    
    Hence anyone who installed GitLab prior to 10.0 may have been seeded the
    database with stale, incorrect foreign key names.
    
    During the Great BigInt Conversion of 2021, the migrations assumed that:
    
    1. The foreign key `fk_be5624bf37` existed for `ci_sources_pipelines`.
    2. The index `index_ci_sources_pipelines_on_source_job_id` existed.
    
    However, older installations may have had the foreign key under the
    original `fk_3f0c88d7dc` and
    `index_ci_pipeline_source_pipelines_on_source_job_id`, respectively.
    
    To eliminate future confusion and migration failures, we now rename the
    foreign key constraints and index to what they should be today.
    
    Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/339844
    
    Changelog: fixed
    3fa6e65f
20210713042000 64 Bytes