I'm wondering if there is a way in the Prisma Client to batch delete database records by id.
Something like this doesn't seem to exist:
const idsToDelete = [5, 29, 255]
prisma.post.deleteMany({
where: {
id: {
equals: idsToDelete
}
}
})
The docs allude to the concept of Scalar List Filters, but this doesn't seem to be supported for numeric lists or perhaps isn't supported in deleteMany.
Under the hood, I'm hoping for a SQL DELETE ... WHERE IN clause. I'd prefer not to:
You can use the in operator:
where: {
id: {
in: idsToDelete
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With