• Stan Hu's avatar
    Clean up duplicate indexes on ci_trigger_requests · bfe38dfe
    Stan Hu authored
    Some installations somehow gained duplicate indexes on
    ci_trigger_requests.trigger_id.
    
    As a result, upgrading to GitLab 12.4.0 may cause this error:
    
    ```
    ArgumentError: Multiple indexes found on ci_trigger_requests columns
    [:trigger_id]. Specify an index name from
    ci_trigger_requests_trigger_id_idx, fk_rails_b8ec8b7245,
    index_ci_trigger_requests_on_trigger_id
    ```
    
    This error comes from ActiveRecord's `index_name_for_remove`. This
    method raises this exception if the `remove_index` is ambiguous.
    
    Since our end state is to remove all indexes on
    `ci_trigger_requests.trigger_id`, find the indexes that have this
    signature and pass in an explicit `name` to disambiguate the index to
    drop.
    
    Closes https://gitlab.com/gitlab-org/gitlab/issues/34818
    bfe38dfe
20191016072826_replace_ci_trigger_requests_index.rb 922 Bytes