fix(db): truncate downstream tables before services dedup to avoid FK violation (GRO-365) #197
@@ -423,6 +423,9 @@ async function seed() {
|
||||
}
|
||||
console.log(`✓ Created ${allStaff.length} staff (1 manager, 1 receptionist, 3 groomers, 3 bathers)`);
|
||||
|
||||
// Truncate downstream tables before services dedup to avoid FK violation
|
||||
await db.execute(sql`TRUNCATE appointments, invoices, invoice_line_items, invoice_tip_splits, grooming_visit_logs CASCADE`);
|
||||
|
||||
// ── Services ──
|
||||
// Deduplicate existing services (keep lowest id per name) before inserting.
|
||||
await db.execute(sql`
|
||||
|
||||
Reference in New Issue
Block a user