summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Brandl <abrandl@gitlab.com>2018-02-21 13:54:35 +0100
committerAndreas Brandl <abrandl@gitlab.com>2018-02-21 13:54:35 +0100
commitb25319f92b096a70b84f645ff80af17954266fb5 (patch)
treeb6286d88d357e0b99ec3dfe6de17799555cc06e7
parent3dbec2c28534f1df2b229ae22a1d017bf1606143 (diff)
downloadgitlab-ce-b25319f92b096a70b84f645ff80af17954266fb5.tar.gz
More readable SQL query.
-rw-r--r--app/finders/members_finder.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/finders/members_finder.rb b/app/finders/members_finder.rb
index 2ec6cc456af..4734d97b8c7 100644
--- a/app/finders/members_finder.rb
+++ b/app/finders/members_finder.rb
@@ -38,9 +38,13 @@ class MembersFinder
<<~SQL
SELECT DISTINCT ON (user_id, invite_email) member_union.*
FROM (#{union.to_sql}) AS member_union
- ORDER BY
- user_id, invite_email,
- CASE WHEN type = 'ProjectMember' THEN 1 WHEN type = 'GroupMember' THEN 2 ELSE 3 END
+ ORDER BY user_id,
+ invite_email,
+ CASE
+ WHEN type = 'ProjectMember' THEN 1
+ WHEN type = 'GroupMember' THEN 2
+ ELSE 3
+ END
SQL
else
# Older versions of MySQL do not support window functions (and DISTINCT ON is postgres-specific).