diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-03-09 12:50:57 +0000 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-03-09 12:50:57 +0000 |
commit | 1221035824fa35490765e34ed7633edd6f44fae3 (patch) | |
tree | e1920fb9589d4a9b2ddf0423521f8cd9988fe4eb | |
parent | 9fd34e42464d3bad0dbf523166385f54902e1a48 (diff) | |
parent | 43957e7a8189dc23e5a1ad66a1a85255d65ed72c (diff) | |
download | gitlab-ce-1221035824fa35490765e34ed7633edd6f44fae3.tar.gz |
Merge branch 'sh-make-add-index-idempotent' into 'master'
Fix index name to Rails default to ensure idempotency
See merge request gitlab-org/gitlab-ce!17654
-rw-r--r-- | db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb b/db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb index 0cf665ac935..b616cc2fd30 100644 --- a/db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb +++ b/db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb @@ -3,20 +3,21 @@ class AddSectionNameIdIndexOnCiBuildTraceSections < ActiveRecord::Migration # Set this constant to true if this migration requires downtime. DOWNTIME = false + INDEX_NAME = 'index_ci_build_trace_sections_on_section_name_id' disable_ddl_transaction! def up # MySQL may already have this as a foreign key - unless index_exists?(:ci_build_trace_sections, :section_name_id) - add_concurrent_index :ci_build_trace_sections, :section_name_id + unless index_exists?(:ci_build_trace_sections, :section_name_id, name: INDEX_NAME) + add_concurrent_index :ci_build_trace_sections, :section_name_id, name: INDEX_NAME end end def down # We cannot remove index for MySQL because it's needed for foreign key if Gitlab::Database.postgresql? - remove_concurrent_index :ci_build_trace_sections, :section_name_id + remove_concurrent_index :ci_build_trace_sections, :section_name_id, name: INDEX_NAME end end end |