chore(coderd/database): enforce workspace ACL JSON object constraints (#22019)

The constraints prevent faulty code from saving 'null' as JSON and breaking the `workspaces_expanded` view.
This commit is contained in:
George K authored and GitHub committed 2026-02-10 16:17:29 -08:00
1 parent e27c4dcd92
commit be94af386c
6 files changed
+111 -1

No files matched your search

+3 -1
View File
@@ -2736,7 +2736,9 @@ CREATE TABLE workspaces (
favorite boolean DEFAULT false NOT NULL,
next_start_at timestamp with time zone,
group_acl jsonb DEFAULT '{}'::jsonb NOT NULL,
user_acl jsonb DEFAULT '{}'::jsonb NOT NULL
user_acl jsonb DEFAULT '{}'::jsonb NOT NULL,
CONSTRAINT group_acl_is_object CHECK ((jsonb_typeof(group_acl) = 'object'::text)),
CONSTRAINT user_acl_is_object CHECK ((jsonb_typeof(user_acl) = 'object'::text))
);
COMMENT ON COLUMN workspaces.favorite IS 'Favorite is true if the workspace owner has favorited the workspace.';