Skip to content

Commit 0d0ea98

Browse files
authored
fix: Filter by deleted when querying workspaces (coder#4512)
Fixes coder#4508.
1 parent 0fa8f52 commit 0d0ea98

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

coderd/database/queries.sql.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaces.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ WHERE
109109
-- Filter by owner_name
110110
AND CASE
111111
WHEN @owner_username :: text != '' THEN
112-
owner_id = (SELECT id FROM users WHERE lower(username) = lower(@owner_username))
112+
owner_id = (SELECT id FROM users WHERE lower(username) = lower(@owner_username) AND deleted = false)
113113
ELSE true
114114
END
115115
-- Filter by template_name
116116
-- There can be more than 1 template with the same name across organizations.
117117
-- Use the organization filter to restrict to 1 org if needed.
118118
AND CASE
119119
WHEN @template_name :: text != '' THEN
120-
template_id = ANY(SELECT id FROM templates WHERE lower(name) = lower(@template_name))
120+
template_id = ANY(SELECT id FROM templates WHERE lower(name) = lower(@template_name) AND deleted = false)
121121
ELSE true
122122
END
123123
-- Filter by template_ids

0 commit comments

Comments
 (0)