Browse Source

fix(nocodb): add missing await for transaction

pull/5349/head
Wing-Kam Wong 2 years ago
parent
commit
7d0037b305
  1. 8
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

8
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -2132,7 +2132,7 @@ class BaseModelSqlv2 {
updatePkValues.push(pkValues); updatePkValues.push(pkValues);
} }
transaction.commit(); await transaction.commit();
for (const pkValues of updatePkValues) { for (const pkValues of updatePkValues) {
newData.push(await this.readByPk(pkValues)); newData.push(await this.readByPk(pkValues));
@ -2142,7 +2142,7 @@ class BaseModelSqlv2 {
return res; return res;
} catch (e) { } catch (e) {
if (transaction) transaction.rollback(); if (transaction) await transaction.rollback();
throw e; throw e;
} }
} }
@ -2220,13 +2220,13 @@ class BaseModelSqlv2 {
res.push(d); res.push(d);
} }
transaction.commit(); await transaction.commit();
await this.afterBulkDelete(deleted, this.dbDriver, cookie); await this.afterBulkDelete(deleted, this.dbDriver, cookie);
return res; return res;
} catch (e) { } catch (e) {
if (transaction) transaction.rollback(); if (transaction) await transaction.rollback();
console.log(e); console.log(e);
throw e; throw e;
} }

Loading…
Cancel
Save