I’d like to delete two items in the transaction an...
# orm-help
p
I’d like to delete two items in the transaction and update one if exists. If any of those three do not exists, that’s okay. Right now it throws error when any of those do not exists. Is there better way to do this?
Copy code
const [configDelete, billingDelete, userUpdate] = await prisma.$transaction([
    prisma.config.delete({
      where: { uid }
    }),
    prisma.billing.delete({
      where: { uid }
    }),
    prisma.user.update({
      where: { id: uid },
      data: {
        trialDays: 0
      }
    })
  ])
1
n
Hey Patrick 👋
Right now it throws error when any of those do not exists. Is there better way to do this?
update
and
delete
always throw
RecordNotFound
exceptions when a record doesn’t exist, so as far as I can tell there’s not really a better way here 🙂
p
Thanks Nikolas