BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
2719b2f0
Commit
2719b2f0
authored
Jul 07, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify stage_id migration as we now use relations
parent
320229e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
migrate_build_stage_id_reference.rb
.../background_migration/migrate_build_stage_id_reference.rb
+4
-9
No files found.
lib/gitlab/background_migration/migrate_build_stage_id_reference.rb
View file @
2719b2f0
...
...
@@ -2,19 +2,14 @@ module Gitlab
module
BackgroundMigration
class
MigrateBuildStageIdReference
def
perform
(
start_id
,
stop_id
)
scope
=
if
stop_id
.
to_i
.
nonzero?
"ci_builds.id BETWEEN
#{
start_id
.
to_i
}
AND
#{
stop_id
.
to_i
}
"
else
"ci_builds.id >=
#{
start_id
.
to_i
}
"
end
sql
=
<<-
SQL
.
strip_heredoc
UPDATE
"ci_builds"
SET
"stage_id"
=
UPDATE
ci_builds
SET
stage_id
=
(SELECT id FROM ci_stages
WHERE ci_stages.pipeline_id = ci_builds.commit_id
AND ci_stages.name = ci_builds.stage)
WHERE
#{
scope
}
AND "ci_builds"."stage_id" IS NULL
WHERE ci_builds.id BETWEEN
#{
start_id
.
to_i
}
AND
#{
stop_id
.
to_i
}
AND ci_builds.stage_id IS NULL
SQL
ActiveRecord
::
Base
.
connection
.
execute
(
sql
)
...
...
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