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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
090ed087
Commit
090ed087
authored
Jun 21, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bump build stage id reference migration identifier
parent
885d63d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
15 deletions
+34
-15
db/post_migrate/20170526185921_migrate_build_stage_reference.rb
...t_migrate/20170526185921_migrate_build_stage_reference.rb
+7
-15
db/post_migrate/20170526190000_migrate_build_stage_reference_again.rb
...ate/20170526190000_migrate_build_stage_reference_again.rb
+27
-0
No files found.
db/post_migrate/20170526185921_migrate_build_stage_reference.rb
View file @
090ed087
...
...
@@ -3,25 +3,17 @@ class MigrateBuildStageReference < ActiveRecord::Migration
DOWNTIME
=
false
disable_ddl_transaction!
##
# This is an empty migration, content has been moved to a new one:
# post migrate 20170526190000 MigrateBuildStageReferenceAgain
#
# See gitlab-org/gitlab-ce!12337 for more details.
def
up
disable_statement_timeout
stage_id
=
Arel
.
sql
<<-
SQL
.
strip_heredoc
(SELECT id FROM ci_stages
WHERE ci_stages.pipeline_id = ci_builds.commit_id
AND ci_stages.name = ci_builds.stage)
SQL
update_column_in_batches
(
:ci_builds
,
:stage_id
,
stage_id
)
do
|
table
,
query
|
query
.
where
(
table
[
:stage_id
].
eq
(
nil
))
end
# noop
end
def
down
disable_statement_timeout
update_column_in_batches
(
:ci_builds
,
:stage_id
,
nil
)
# noop
end
end
db/post_migrate/20170526190000_migrate_build_stage_reference_again.rb
0 → 100644
View file @
090ed087
class
MigrateBuildStageReferenceAgain
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
disable_statement_timeout
stage_id
=
Arel
.
sql
<<-
SQL
.
strip_heredoc
(SELECT id FROM ci_stages
WHERE ci_stages.pipeline_id = ci_builds.commit_id
AND ci_stages.name = ci_builds.stage)
SQL
update_column_in_batches
(
:ci_builds
,
:stage_id
,
stage_id
)
do
|
table
,
query
|
query
.
where
(
table
[
:stage_id
].
eq
(
nil
))
end
end
def
down
disable_statement_timeout
update_column_in_batches
(
:ci_builds
,
:stage_id
,
nil
)
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