fix: skip records that do not exist (#1084)
This commit is contained in:
parent
15cbad30b4
commit
534faa85cb
@ -6,7 +6,7 @@ import {
|
||||
HasOne,
|
||||
Hookable,
|
||||
ModelCtor,
|
||||
Transactionable,
|
||||
Transactionable
|
||||
} from 'sequelize';
|
||||
import { Model } from './model';
|
||||
import { UpdateGuard } from './update-guard';
|
||||
@ -443,6 +443,9 @@ export async function updateMultipleAssociation(
|
||||
const instance = await association.target.findByPk<any>(item[pk], {
|
||||
transaction,
|
||||
});
|
||||
if (!instance) {
|
||||
continue;
|
||||
}
|
||||
const addAccessor = association.accessors.add;
|
||||
|
||||
await model[addAccessor](item[pk], accessorOptions);
|
||||
|
Loading…
Reference in New Issue
Block a user