Skip to content

Commit

Permalink
More debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksTeresh committed Jun 13, 2024
1 parent ca4fdff commit 86f0dc0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions importer-mankeli/src/utils/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ const bulkCreate = async (model, entities, transaction, properties = ['id']) =>
try {
await model.bulkCreate(entities, {
updateOnDuplicate: getColumnsToUpdate(model, properties),
transaction
transaction,
logging: logger.info
})
} catch (error) {
logger.info(getColumnsToUpdate(model, properties))
logger.error(error)
// If one fails on bulkCreate, re-do them individually and report the individual failures.
for (const entity of entities) {
try {
await model.upsert(entity, {
updateOnDuplicate: getColumnsToUpdate(model, properties),
transaction
transaction,
logging: logger.info
})
} catch (e) {
logger.error(e)
Expand Down

0 comments on commit 86f0dc0

Please sign in to comment.