mirror of
https://github.com/coder/coder.git
synced 2026-06-03 13:08:25 +00:00
be94af386c
The constraints prevent faulty code from saving 'null' as JSON and breaking the `workspaces_expanded` view.
10 lines
475 B
SQL
10 lines
475 B
SQL
-- Add constraints that reject 'null'::jsonb for group and user ACLs
|
|
-- because they would break the new workspace_expanded view.
|
|
|
|
UPDATE workspaces SET group_acl = '{}'::jsonb WHERE group_acl = 'null'::jsonb;
|
|
UPDATE workspaces SET user_acl = '{}'::jsonb WHERE user_acl = 'null'::jsonb;
|
|
|
|
ALTER TABLE workspaces
|
|
ADD CONSTRAINT group_acl_is_object CHECK (jsonb_typeof(group_acl) = 'object'),
|
|
ADD CONSTRAINT user_acl_is_object CHECK (jsonb_typeof(user_acl) = 'object');
|