W
Wasp12mo ago
mattttman

Update DB Field using Another Field

Hi! I'm looking for a way to update a database value by referencing the value of another field. See example below. It appears that this exists in standalone Prisma- is there a way to do it in wasp? context.entities.User.updateMany({ where: { // Something }, data: { credits: { set: context.entities.User.creditAllowance } }
1 Reply
martinsos
martinsos12mo ago
@mattttman oh interesting! So you basically tell Prisma: "Hey, for all Users that match the where clause, set credits to the value of their creditAllowance field.". If it is doable in Prisma, it should also be doable with Prisma in Wasp, unless we didn't expose something that Prisma needs: can you please share the piece of Prisma docs that shows how this would be done in Prisma?

Did you find this page helpful?