Browse Source

fix: update use of transaction

nc-expand-rows
DarkPhoenix2704 2 months ago
parent
commit
3aafbca10f
  1. 9
      packages/nocodb/src/db/BaseModelSqlv2.ts

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

@ -5482,7 +5482,7 @@ class BaseModelSqlv2 {
} }
if ('beforeBulkInsert' in this) { if ('beforeBulkInsert' in this) {
await this.beforeBulkInsert(insertDatas, trx, cookie); await this.beforeBulkInsert(insertDatas, transaction, cookie);
} }
// await this.beforeInsertb(insertDatas, null); // await this.beforeInsertb(insertDatas, null);
@ -5574,7 +5574,7 @@ class BaseModelSqlv2 {
await this.runOps( await this.runOps(
postInsertOps.map((f) => f(rowId)), postInsertOps.map((f) => f(rowId)),
trx, transaction,
); );
} }
@ -5593,7 +5593,8 @@ class BaseModelSqlv2 {
return responses; return responses;
} catch (e) { } catch (e) {
await transaction?.rollback(); if (!trx) await transaction?.rollback();
// await this.errorInsertb(e, data, null); // await this.errorInsertb(e, data, null);
throw e; throw e;
} }
@ -5849,7 +5850,7 @@ class BaseModelSqlv2 {
return newData; return newData;
} catch (e) { } catch (e) {
if (transaction) await transaction.rollback(); if (!trx) await transaction.rollback();
throw e; throw e;
} }
} }

Loading…
Cancel
Save