Browse Source

fix: bulk update mising record handling

pull/8315/head
mertmit 7 months ago
parent
commit
3a86f23c23
  1. 14
      packages/nocodb/src/db/BaseModelSqlv2.ts

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

@ -3739,20 +3739,20 @@ class BaseModelSqlv2 {
if (oldRecords.length === tempToRead.length) {
prevData.push(...oldRecords);
} else {
for (const record of oldRecords) {
const pkValues = this._extractPksValues(record);
const exists = tempToRead.find((d) => d === pkValues);
for (const recordPk of tempToRead) {
const oldRecord = oldRecords.find(
(r) => this._extractPksValues(r) === recordPk,
);
if (!exists) {
if (!oldRecord) {
// throw or skip if no record found
if (throwExceptionIfNotExist) {
NcError.recordNotFound(JSON.stringify(pkValues));
NcError.recordNotFound(JSON.stringify(recordPk));
}
continue;
}
prevData.push(record);
prevData.push(oldRecord);
}
}
}

Loading…
Cancel
Save