fix: use unique workspace owners over unique users (#11044)

This commit is contained in:
Garrett Delfosse
2023-12-07 10:53:15 -05:00
committed by GitHub
parent 091fdd6761
commit 8aea6040c8
10 changed files with 212 additions and 2 deletions

View File

@ -287,6 +287,15 @@ WHERE
AND LOWER("name") = LOWER(@name)
ORDER BY created_at DESC;
-- name: GetWorkspaceUniqueOwnerCountByTemplateIDs :many
SELECT
template_id, COUNT(DISTINCT owner_id) AS unique_owners_sum
FROM
workspaces
WHERE
template_id = ANY(@template_ids :: uuid[]) AND deleted = false
GROUP BY template_id;
-- name: InsertWorkspace :one
INSERT INTO
workspaces (