Paul
07/21/2021, 8:14 AMdb.damFile.updateMany({
data: {
deletedAt: DateTime.utc().toString(),
},
where: {
id: {
in: ids.join(",")
}
},
})
This obviously doesn't work. What's the best way to handle this use-case? I don't want to use a for loop and delete each one individually.
Note: I could use an execute raw and use a string array...
ThanksTomáš Kallup
07/21/2021, 8:17 AMids
as an array? Without the .join
, because to me it feels like that should work.Paul
07/21/2021, 8:19 AMType '{ in: Buffer[]; }' is not assignable to type 'Buffer | BytesFilter | undefined'.
Object literal may only specify known properties, and 'in' does not exist in type 'Buffer | BytesFilter'.ts(2322)
Paul
07/21/2021, 8:20 AMTomáš Kallup
07/21/2021, 8:27 AMid
property and it should take you into prismas types where you can see what can actually go into BytesFilter
. I couldn't find this type in my prisma install, so sadly I can't help you.Paul
07/21/2021, 9:14 AMconst query = db.$executeRaw(
`
update DamFile
set deletedAt = ?
where id in (?)
`,
DateTime.utc().toString(),
ids.join(",")
)
const result = await db.$transaction([query])
console.log(result)
It works with one item, but doesn't work with multiple. if I do ("?") I get an error.
Hopefully someone from Prisma can reply.