From cca0724aa05cafd08ba44776998df0ac5240c0c0 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Mon, 5 Jun 2023 00:57:29 +0530 Subject: [PATCH] fix: add commit and rollback Signed-off-by: Pranav C --- packages/nocodb/src/db/BaseModelSqlv2.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 4fc86e7c4f..c38f0ad51d 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -1945,10 +1945,13 @@ class BaseModelSqlv2 { .del() .where(await this._wherePk(id)); + if (!_trx) await trx.commit(); + await this.afterDelete(data, trx, cookie); return response; } catch (e) { console.log(e); + if (!_trx) await trx.rollback(); await this.errorDelete(e, id, trx, cookie); throw e; }