Jijin P
01/30/2021, 4:36 PMawait prisma.campaigns.update({
where: {
id:{
includes: id_lists
}
},
data: {
credits: {
decrement: 10000
}
}
})
radisa
02/01/2021, 3:04 AMawait prisma.$transaction([...id_lists.map(id => prisma.campaigns.update({
where: {
id
},
data: {
credits: {
decrement: 10000
}
}
})])
Though maybe it's not effective since this means you run n
transaction query.Ryan
02/01/2021, 6:59 AMupdateMany
in this case?
Something like:
await prisma.campaigns.updateMany({
where: {
id:{
in: id_lists
}
},
data: {
credits: {
decrement: 10000
}
}
})
Jijin P
02/01/2021, 7:17 AM