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
Jérome Perrin
gitlab-ce
Commits
56681cf7
Commit
56681cf7
authored
May 26, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a separate migration to create pipeline stages index
parent
918ababb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
db/post_migrate/20170526101042_migrate_pipeline_stages.rb
db/post_migrate/20170526101042_migrate_pipeline_stages.rb
+0
-10
db/post_migrate/20170526180645_create_index_in_pipeline_stages.rb
...migrate/20170526180645_create_index_in_pipeline_stages.rb
+15
-0
No files found.
db/post_migrate/20170526101042_migrate_pipeline_stages.rb
View file @
56681cf7
...
...
@@ -16,8 +16,6 @@ class MigratePipelineStages < ActiveRecord::Migration
ORDER BY stage_idx
SQL
add_concurrent_index
(
:ci_stages
,
[
:pipeline_id
,
:name
])
add_column
(
:ci_builds
,
:stage_id
,
:integer
)
stage_id
=
Arel
.
sql
(
'(SELECT id FROM ci_stages '
\
...
...
@@ -31,13 +29,5 @@ class MigratePipelineStages < ActiveRecord::Migration
def
down
execute
(
'TRUNCATE TABLE ci_stages'
)
if
column_exists?
(
:ci_builds
,
:stage_id
)
remove_column
(
:ci_builds
,
:stage_id
)
end
if
index_exists?
(
:ci_stages
,
[
:pipeline_id
,
:name
])
remove_index
(
:ci_stages
,
[
:pipeline_id
,
:name
])
end
end
end
db/post_migrate/20170526180645_create_index_in_pipeline_stages.rb
0 → 100644
View file @
56681cf7
class
CreateIndexInPipelineStages
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_index
(
:ci_stages
,
[
:pipeline_id
,
:name
])
end
def
down
remove_index
(
:ci_stages
,
[
:pipeline_id
,
:name
])
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