BigW Consortium Gitlab

Commit 6a2bcb4b by Stan Hu

Merge branch 'sh-fix-delete-assignees-mysql' into 'master'

Fix deletion of issue assignees for MySQL See merge request !11426
parents 39baadbd 6ea4d333
......@@ -37,10 +37,15 @@ module Members
else
project = member.source
IssueAssignee.delete_all(
user_id: member.user_id,
issue_id: project.issues.opened.assigned_to(member.user).select(:id)
)
# SELECT 1 FROM issues WHERE issues.id = issue_assignees.issue_id AND issues.project_id = X
issues = Issue.unscoped.select(1).
where('issues.id = issue_assignees.issue_id').
where(project_id: project.id)
# DELETE FROM issue_assignees WHERE user_id = X AND EXISTS (...)
IssueAssignee.unscoped.
where('user_id = :user_id AND EXISTS (:sub)', user_id: member.user_id, sub: issues).
delete_all
project.merge_requests.opened.assigned_to(member.user).update_all(assignee_id: nil)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment