How to use soft deleted rows in bulkCreate sequelize

323 Views Asked by At

I have 2 tables in mysql Serviceability and ServiceabilityLive, the first table is updated by ops team and second table is updated cron at given time.

I am using below code to update the same in live table but it is not working.

const serviceablities = await Serviceability.findAll({
    where: {
      lab_id: lab.id
    },
    paranoid: false
  }).then(serviceablities => {
    return serviceablities.map(serviceablity => serviceablity.dataValues)
  })
await ServiceabilityLive.bulkCreate(serviceablities, { updateOnDuplicate: ["id"]})

But this is not updating the row that is deletedAt not null in Serviceability table but it is not getting updated in ServiceabilityLive table.

Can you please help me and let me know what am I missing.

0

There are 0 best solutions below