Skip to content

[Rails5] Fix `Index name 'index_ci_job_artifacts_on_file_store' on table 'ci_job_artifacts' already exists`

Note: add rails5 to a branch name to trigger rails5 specific CI jobs.

https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/67504092

  74) Gitlab::BackgroundMigration::MigrateStageIndex correctly migrates stages indices
      Failure/Error: add_index(table_name, column_name, options)

      StandardError:
        An error has occurred, all later migrations canceled:

        Index name 'index_ci_job_artifacts_on_file_store' on table 'ci_job_artifacts' already exists
      # ./config/initializers/postgresql_opclasses_support.rb:80:in `add_index_options'
      # ./config/initializers/postgresql_opclasses_support.rb:141:in `add_index'
      # ./lib/gitlab/database/migration_helpers.rb:69:in `add_concurrent_index'
      # ./db/migrate/20180418053107_add_index_to_ci_job_artifacts_file_store.rb:9:in `up'
      # ./spec/support/helpers/migrations_helpers.rb:72:in `block in schema_migrate_down!'
      # ./spec/support/helpers/migrations_helpers.rb:92:in `disable_migrations_output'
      # ./spec/support/helpers/migrations_helpers.rb:71:in `schema_migrate_down!'
      # ./spec/spec_helper.rb:185:in `block (2 levels) in <top (required)>'
      # ------------------
      # --- Caused by: ---
      # ArgumentError:
      #   Index name 'index_ci_job_artifacts_on_file_store' on table 'ci_job_artifacts' already exists
      #   ./config/initializers/postgresql_opclasses_support.rb:80:in `add_index_options'