Fix dev seed for single-company schema, sync RBAC on startup

- Remove all company_id references from dev-seed.ts (removed in 0021)
- seedPermissions now syncs role-permission assignments for system roles
  when new permissions are added (e.g., vault.view assigned to admin)
- Fix enum migration: use text cast workaround for PostgreSQL's
  "unsafe use of new enum value" error on fresh DB creation
This commit is contained in:
Ryan Moon
2026-03-30 07:10:20 -05:00
parent e346e072b8
commit 328b4a1f7b
4 changed files with 50 additions and 27 deletions

View File

@@ -1 +1,2 @@
ALTER TYPE "repair_ticket_status" ADD VALUE 'new' BEFORE 'in_transit';
-- Must commit before using the new enum value
ALTER TYPE "repair_ticket_status" ADD VALUE IF NOT EXISTS 'new' BEFORE 'in_transit';

View File

@@ -1 +1,3 @@
ALTER TABLE "repair_ticket" ALTER COLUMN "status" SET DEFAULT 'new';
-- Use text cast to avoid the "unsafe use of new enum value" error
-- when 0019 (ADD VALUE) and this run in the same session
ALTER TABLE "repair_ticket" ALTER COLUMN "status" SET DEFAULT 'new'::text::repair_ticket_status;