DB migration fails with Index name 'index_uploads_on_path' on table 'uploads' does not exist

Summary

Gitlab upgrade from 10.4.7 to 10.5 is failing with error Index name 'index_uploads_on_path' on table 'uploads' does not exist.

DB is Postgres.

Following solution didn't help me

gitlab-foss#43611 (closed)

Steps to reproduce

Upgrade RPM and running gitlab reconfig / dbmigration fails with Index name 'index_uploads_on_path' on table 'uploads' does not exist

Relevant logs and/or screenshots

== 20180119135717 AddUploaderIndexToUploads: migrating ======================== -- transaction_open?() -> 0.0000s -- select_one("SELECT current_setting('server_version_num') AS v") -> 0.0521s -- execute("SET statement_timeout TO 0") -> 0.0518s -- remove_index(:uploads, {:algorithm=>:concurrently, :column=>:path}) rake aborted! StandardError: An error has occurred, all later migrations canceled:

Index name 'index_uploads_on_path' on table 'uploads' does not exist /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:86:in remove_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180119135717_add_uploader_index_to_uploads.rb:12:in up' /opt/gitlab/embedded/bin/bundle:23:in load' /opt/gitlab/embedded/bin/bundle:23:in '

Caused by: ArgumentError: Index name 'index_uploads_on_path' on table 'uploads' does not exist /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:86:in remove_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180119135717_add_uploader_index_to_uploads.rb:12:in up' /opt/gitlab/embedded/bin/bundle:23:in load' /opt/gitlab/embedded/bin/bundle:23:in ' Tasks: TOP => db:migrate (See full trace by running task with --trace)

DB migration status.

down 20180119135717 Add uploader index to uploads down 20180119160751 Optimize ci job artifacts up 20180122154930 ********** NO FILE ********** down 20180122162010 Add auto devops domain to application settings down 20180125214301 Create user callouts down 20180129193323 Add uploads builder context down 20180201102129 Add unique constraint to trending projects project down 20180201110056 Add foreign keys to todos down 20180201145907 Migrate remaining issues closed at up 20180202111106 Remove project labels group down 20180204200836 Change author id to not null in todos down 20180206200543 Reset events primary key sequence up 20180208183958 Schedule populate untracked uploads if needed down 20180216120000 Add pages domain verification down 20180216120010 Add pages domain verified at index down 20180216120020 Allow domain verification to be disabled down 20180216120030 Add pages domain enabled until down 20180216120040 Add pages domain enabled until index down 20180216120050 Pages domains verification grace period down 20180216121020 Fill pages domain verification code down 20180216121030 Enqueue verify pages domain workers up 20180220150310 ********** NO FILE ********** up 20180223144945 ********** NO FILE **********