Files
temetro/backend/drizzle/0011_remap_viewer_to_member.sql
T
Khalid Abdi e37d131800 backend: replace viewer role with pharmacy and lab department roles
Drop the unused read-only "viewer" role and remap any members (and pending
invitations) holding it to "member" via a custom migration. Add a "lab"
statement (read/write) granted to all full clinicians, plus two new
provisionable department roles: "pharmacy" (patient/appointment read,
prescription read+write — no delete, which doubles as the full-clinician
marker the frontend probes) and "lab" (patient/appointment read, task queue,
lab results via the new statement). Both join TASK_DEPARTMENTS so tasks can
be assigned to them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 21:03:15 +03:00

9 lines
484 B
SQL

-- Custom SQL migration file, put your code below! --
-- The read-only `viewer` role was removed from src/lib/access.ts. Members left
-- with it would fail every permission check (requirePermission looks roles up
-- by name), so remap them to `member` (clinician). Pending invitations carry a
-- role too — cover them as well.
UPDATE "member" SET "role" = 'member' WHERE "role" = 'viewer';--> statement-breakpoint
UPDATE "invitation" SET "role" = 'member' WHERE "role" = 'viewer';