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
aba59f0d
Commit
aba59f0d
authored
Feb 07, 2019
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add distinct to avoid duplicated updates
parent
5730112d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
ee/db/migrate/20190114040404_correct_approvals_required.rb
ee/db/migrate/20190114040404_correct_approvals_required.rb
+3
-2
No files found.
ee/db/migrate/20190114040404_correct_approvals_required.rb
View file @
aba59f0d
...
...
@@ -16,14 +16,15 @@ class CorrectApprovalsRequired < ActiveRecord::Migration[5.0]
class
ApprovalProjectRule
<
ActiveRecord
::
Base
self
.
table_name
=
'approval_project_rules'
has_many
:approval_merge_request_rule_source
has_many
:approval_merge_request_rules
,
through: :approval_merge_request_rule_source
has_many
:approval_merge_request_rule_source
s
has_many
:approval_merge_request_rules
,
through: :approval_merge_request_rule_source
s
end
def
up
ApprovalProjectRule
.
joins
(
:approval_merge_request_rules
)
.
where
(
'approval_merge_request_rules.approvals_required = 0 AND approval_project_rules.approvals_required > 0'
)
.
distinct
.
find_each
do
|
project_rule
|
# Pluck as MySQL prohibits subquery that references the table being updated
mr_rule_ids
=
ApprovalMergeRequestRule
...
...
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