From dcbfa9f1c5deb235c764f141220af562bf919b17 Mon Sep 17 00:00:00 2001 From: Mildred Ki'Lya Date: Fri, 19 Jan 2024 23:23:03 +0100 Subject: [PATCH] fix: setPaymentReferenceType patch for payments for versions >0.18 <0.20 --- backend/patches/setPaymentReferenceType.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/patches/setPaymentReferenceType.ts b/backend/patches/setPaymentReferenceType.ts index a141e201..70f57b01 100644 --- a/backend/patches/setPaymentReferenceType.ts +++ b/backend/patches/setPaymentReferenceType.ts @@ -2,7 +2,10 @@ import { DatabaseManager } from '../database/manager'; async function execute(dm: DatabaseManager) { await dm.db!.knex!('Payment') - .where({ referenceType: null }) + .where({ referenceType: null, paymentType: 'Pay' }) + .update({ referenceType: 'PurchaseInvoice' }); + await dm.db!.knex!('Payment') + .where({ referenceType: null, paymentType: 'Receive' }) .update({ referenceType: 'SalesInvoice' }); }