Do not try to commit empty array of entity records

Signed-off-by: Damon Kaswell <damon.kaswell1@hp.com>
This commit is contained in:
Damon Kaswell
2023-01-10 08:54:07 -08:00
parent cbef34012c
commit e04dcef5a0
@@ -577,13 +577,15 @@ export class IncrementalIngestionDatabaseManager {
.update('ingestion_mark_id', markId)
.whereIn('ref', existingRefsArray);
await tx('ingestion_mark_entities').insert(
newRefs.map(ref => ({
id: v4(),
ingestion_mark_id: markId,
ref,
})),
);
if (newRefs.length > 0) {
await tx('ingestion_mark_entities').insert(
newRefs.map(ref => ({
id: v4(),
ingestion_mark_id: markId,
ref,
})),
);
}
});
}