Browse Source

fix: add commit and rollback

Signed-off-by: Pranav C <pranavxc@gmail.com>
test/reset-fail
Pranav C 1 year ago
parent
commit
cca0724aa0
  1. 3
      packages/nocodb/src/db/BaseModelSqlv2.ts

3
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -1945,10 +1945,13 @@ class BaseModelSqlv2 {
.del() .del()
.where(await this._wherePk(id)); .where(await this._wherePk(id));
if (!_trx) await trx.commit();
await this.afterDelete(data, trx, cookie); await this.afterDelete(data, trx, cookie);
return response; return response;
} catch (e) { } catch (e) {
console.log(e); console.log(e);
if (!_trx) await trx.rollback();
await this.errorDelete(e, id, trx, cookie); await this.errorDelete(e, id, trx, cookie);
throw e; throw e;
} }

Loading…
Cancel
Save