feat: Workspace filters case insensitive (#2646)

This commit is contained in:
Steven Masley
2022-06-25 06:22:59 -05:00
committed by GitHub
parent 90815e5119
commit 3312c814bd
7 changed files with 90 additions and 37 deletions

View File

@ -25,7 +25,7 @@ WHERE
-- Filter by owner_name
AND CASE
WHEN @owner_username :: text != '' THEN
owner_id = (SELECT id FROM users WHERE username = @owner_username)
owner_id = (SELECT id FROM users WHERE lower(username) = lower(@owner_username))
ELSE true
END
-- Filter by template_name
@ -33,7 +33,7 @@ WHERE
-- Use the organization filter to restrict to 1 org if needed.
AND CASE
WHEN @template_name :: text != '' THEN
template_id = ANY(SELECT id FROM templates WHERE name = @template_name)
template_id = ANY(SELECT id FROM templates WHERE lower(name) = lower(@template_name))
ELSE true
END
-- Filter by template_ids
@ -45,7 +45,7 @@ WHERE
-- Filter by name, matching on substring
AND CASE
WHEN @name :: text != '' THEN
LOWER(name) LIKE '%' || LOWER(@name) || '%'
name ILIKE '%' || @name || '%'
ELSE true
END
;