Files
gochat/migrations/000023_align_custom_role_permissions.up.sql
T

8 lines
341 B
SQL

-- Align custom_roles.permissions with Chatwoot custom-role permission arrays.
-- Existing legacy JSON maps remain readable in Go code; new writes use arrays.
ALTER TABLE custom_roles ALTER COLUMN permissions SET DEFAULT '[]'::jsonb;
UPDATE custom_roles
SET permissions = '[]'::jsonb
WHERE permissions IS NULL OR permissions = '{}'::jsonb;