Commit 7f32b9d7 authored by Yorick Peterse's avatar Yorick Peterse

Merge branch 'rails5-exists-query' into 'master'

Replace `.exists` with `EXISTS ()`

Closes #46277

See merge request gitlab-org/gitlab-ce!19178
parents 3f6fffe9 1d766bfb
...@@ -63,7 +63,7 @@ module Boards ...@@ -63,7 +63,7 @@ module Boards
def without_board_labels(issues) def without_board_labels(issues)
return issues unless board_label_ids.any? return issues unless board_label_ids.any?
issues.where.not(issues_label_links.limit(1).arel.exists) issues.where.not('EXISTS (?)', issues_label_links.limit(1))
end end
def issues_label_links def issues_label_links
...@@ -71,10 +71,8 @@ module Boards ...@@ -71,10 +71,8 @@ module Boards
end end
def with_list_label(issues) def with_list_label(issues)
issues.where( issues.where('EXISTS (?)', LabelLink.where("label_links.target_type = 'Issue' AND label_links.target_id = issues.id")
LabelLink.where("label_links.target_type = 'Issue' AND label_links.target_id = issues.id") .where("label_links.label_id = ?", list.label_id).limit(1))
.where("label_links.label_id = ?", list.label_id).limit(1).arel.exists
)
end end
end end
end 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