fix: filter out deleted users when attempting to delete an organization (#17621)

Closes
[coder/internal#601](https://github.com/coder/internal/issues/601)
This commit is contained in:
brettkolodny
2025-05-01 12:26:01 -04:00
committed by GitHub
parent cae4fa8b45
commit b7e08ba7c9
6 changed files with 319 additions and 11 deletions
+6 -1
View File
@@ -482,9 +482,14 @@ BEGIN
);
member_count := (
SELECT count(*) as count FROM organization_members
SELECT
count(*) AS count
FROM
organization_members
LEFT JOIN users ON users.id = organization_members.user_id
WHERE
organization_members.organization_id = OLD.id
AND users.deleted = FALSE
);
provisioner_keys_count := (