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
ce71b1ce
Commit
ce71b1ce
authored
Jan 24, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix removing redundant pipeline stages on MySQL
parent
e4aac7f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb
...igrate/20180119121225_remove_redundant_pipeline_stages.rb
+11
-4
No files found.
db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb
View file @
ce71b1ce
...
@@ -12,12 +12,19 @@ class RemoveRedundantPipelineStages < ActiveRecord::Migration
...
@@ -12,12 +12,19 @@ class RemoveRedundantPipelineStages < ActiveRecord::Migration
SQL
SQL
execute
<<~
SQL
execute
<<~
SQL
UPDATE ci_builds SET stage_id = NULL WHERE
ci_builds.
stage_id IN (
#{
redundant_stages_ids
}
)
UPDATE ci_builds SET stage_id = NULL WHERE stage_id IN (
#{
redundant_stages_ids
}
)
SQL
SQL
execute
<<~
SQL
if
Gitlab
::
Database
.
postgresql?
DELETE FROM ci_stages WHERE ci_stages.id IN (
#{
redundant_stages_ids
}
)
execute
<<~
SQL
SQL
DELETE FROM ci_stages WHERE id IN (
#{
redundant_stages_ids
}
)
SQL
else
# We can't modify a table we are selecting from on MySQL
execute
<<~
SQL
DELETE a FROM ci_stages AS a, ci_stages AS b
WHERE a.pipeline_id = b.pipeline_id AND a.name = b.name
SQL
end
end
end
def
down
def
down
...
...
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