Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
43957e7a
Commit
43957e7a
authored
Mar 08, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix index name to Rails default to ensure idempotency
See
https://gitlab.com/gitlab-com/infrastructure/issues/3822
parent
08c407cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb
...5_add_section_name_id_index_on_ci_build_trace_sections.rb
+4
-3
No files found.
db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb
View file @
43957e7a
...
@@ -3,20 +3,21 @@ class AddSectionNameIdIndexOnCiBuildTraceSections < ActiveRecord::Migration
...
@@ -3,20 +3,21 @@ class AddSectionNameIdIndexOnCiBuildTraceSections < ActiveRecord::Migration
# Set this constant to true if this migration requires downtime.
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
DOWNTIME
=
false
INDEX_NAME
=
'index_ci_build_trace_sections_on_section_name_id'
disable_ddl_transaction!
disable_ddl_transaction!
def
up
def
up
# MySQL may already have this as a foreign key
# MySQL may already have this as a foreign key
unless
index_exists?
(
: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
add_concurrent_index
:ci_build_trace_sections
,
:section_name_id
,
name:
INDEX_NAME
end
end
end
end
def
down
def
down
# We cannot remove index for MySQL because it's needed for foreign key
# We cannot remove index for MySQL because it's needed for foreign key
if
Gitlab
::
Database
.
postgresql?
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
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment