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 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 21:00:25 -04:00
parent c124397a97
commit 64aad1d283
+1 -1
View File
@@ -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 = [