-
-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(schemas): add new tenant role collaborator and deprecate member …
…role
- Loading branch information
1 parent
4f12e52
commit 0c7aa98
Showing
2 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
packages/schemas/alterations/next-1712041436-add-new-organization-role-collaborator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { sql } from '@silverhand/slonik'; | ||
|
||
import type { AlterationScript } from '../lib/types/alteration.js'; | ||
|
||
const alteration: AlterationScript = { | ||
up: async (pool) => { | ||
await pool.query(sql` | ||
insert into organization_roles (tenant_id, id, name, description) | ||
values ('admin', 'collaborator', 'collaborator', 'Collaborator of the tenant, who has permissions to operate the tenant data, but not the tenant settings.'); | ||
insert into organization_role_scope_relations (tenant_id, organization_role_id, organization_scope_id) | ||
values ('admin', 'collaborator', 'read-data'), | ||
('admin', 'collaborator', 'write-data'), | ||
('admin', 'collaborator', 'delete-data'), | ||
('admin', 'collaborator', 'read-member'); | ||
`); | ||
}, | ||
down: async (pool) => { | ||
await pool.query(sql` | ||
delete from organization_roles | ||
where tenant_id = 'admin' and id = 'collaborator'; | ||
delete from organization_role_scope_relations | ||
where tenant_id = 'admin' and organization_role_id = 'collaborator'; | ||
`); | ||
}, | ||
}; | ||
|
||
export default alteration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters