I need to update some fields, but each item should be updated with different value:
await prisma.tokens.updateMany({
where: {
product_id: "123",
},
data: {
contract_address: '0x123456',
mint_edition: i, // <- `i` should be taken from a loop
},
})
Is there a way to update many items each with different data?
As far as I know there is no such functionality, what I would do is splitting it up into 2 separate steps. First, I would get all tokens with getAll({ where: {} }) and then loop over each token and update one at a time with the index from the loop. If you want to make sure that either all tokens update or none, you can wrap everything within a transaction