From 64aad1d28320aef1e2edc9c0a0c34f603e5179bb Mon Sep 17 00:00:00 2001 From: renee-png Date: Mon, 1 Jun 2026 21:00:25 -0400 Subject: [PATCH] Reassign payments_received when merging homeowners mergeHomeownersByAddress reassigned invoices/transactions/work_orders/ estimates but missed payments_received, orphaning payment references on the deleted duplicate. Add it to the FK reassignment list. Co-Authored-By: Claude Opus 4.8 --- src/pages/accounting/lib/mergeHomeowners.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/accounting/lib/mergeHomeowners.ts b/src/pages/accounting/lib/mergeHomeowners.ts index cbb64c8..45cbd0c 100644 --- a/src/pages/accounting/lib/mergeHomeowners.ts +++ b/src/pages/accounting/lib/mergeHomeowners.ts @@ -1,7 +1,7 @@ import { accounting } from "@/lib/accountingClient"; // Tables that reference a homeowner via customer_id — reassigned to the survivor on merge -const CUSTOMER_FK_TABLES = ["estimates", "invoices", "transactions", "work_orders"] as const; +const CUSTOMER_FK_TABLES = ["estimates", "invoices", "payments_received", "transactions", "work_orders"] as const; // Fields copied onto the survivor from a duplicate when the survivor's value is blank const FILLABLE_FIELDS = [