BigW Consortium Gitlab

Commit b25319f9 by Andreas Brandl

More readable SQL query.

parent 3dbec2c2
......@@ -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).
......
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