mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
23 lines
586 B
SQL
23 lines
586 B
SQL
UPDATE
|
|
users
|
|
SET
|
|
-- Replace 'template-admin' and 'user-admin' role with 'admin'
|
|
rbac_roles = array_append(
|
|
array_remove(
|
|
array_remove(rbac_roles, 'template-admin'),
|
|
'user-admin'
|
|
), 'admin')
|
|
WHERE
|
|
-- Only on existing admins. If they have either role, make them an admin
|
|
ARRAY ['template-admin', 'user-admin'] && rbac_roles;
|
|
|
|
|
|
UPDATE
|
|
users
|
|
SET
|
|
-- Replace 'owner' with 'admin'
|
|
rbac_roles = array_replace(rbac_roles, 'owner', 'admin')
|
|
WHERE
|
|
-- Only on the owner
|
|
'owner' = ANY(rbac_roles);
|