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 <noreply@paperclip.ing>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user