Fix knex error when removing existing relations as a batch

Added a fallback of 0 after null coalesce
This commit is contained in:
Michael Olund 2023-04-21 12:11:16 -07:00 committed by GitHub
parent 6000668673
commit 975a3ca03d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -152,7 +152,7 @@ const deleteRelations = async ({
.transacting(trx) .transacting(trx)
.execute(); .execute();
done = batchToDelete.length < batchSize; done = batchToDelete.length < batchSize;
lastId = batchToDelete[batchToDelete.length - 1]?.id; lastId = batchToDelete[batchToDelete.length - 1]?.id || 0;
const batchIds = map(inverseJoinColumn.name, batchToDelete); const batchIds = map(inverseJoinColumn.name, batchToDelete);