From 2674bcb2b6f9279d748846f207b580eaed5e1c41 Mon Sep 17 00:00:00 2001 From: "groombook-engineer[bot]" <3141748+groombook-engineer[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 20:18:31 +0000 Subject: [PATCH] fix(db): add impersonation_sessions and audit_logs to seed TRUNCATE chain Truncate these tables before staff upsert to avoid FK constraint violations when the dev DB already has impersonation sessions referencing staff rows. Co-Authored-By: Paperclip --- packages/db/src/seed.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/db/src/seed.ts b/packages/db/src/seed.ts index 8b1a6c1..19d8fda 100644 --- a/packages/db/src/seed.ts +++ b/packages/db/src/seed.ts @@ -428,7 +428,7 @@ async function seed() { // Truncate downstream tables before services upsert — clears stale appointments // from prior seed runs so the FK constraint on service_id is never violated - await db.execute(sql`TRUNCATE appointments, invoices, invoice_line_items, invoice_tip_splits, grooming_visit_logs CASCADE`); + await db.execute(sql`TRUNCATE impersonation_sessions, impersonation_audit_logs, appointments, invoices, invoice_line_items, invoice_tip_splits, grooming_visit_logs CASCADE`); // ── Services ── // Upsert services using name as unique key. With deterministic IDs in