Update numeric value (add/subtract)

prisma

#1

Couldn’t find any documentation on how to update the existing value of a field. Let’s say I have a “balance” field in the user model. How can I add/subtract value from it in a single query? Or should I first find the existing value and only then update it?


#2

Hey @Sugrow, the option you describe is, I am afraid, the only one right now. Nevertheless, I would encourage you to try and find a different approach as this one might not be the best. If you post your model and your goal below, I might be able to give you some suggestions.

There’s also an open feature request which you can follow to get more information about the situation.

Hope this helps you :slightly_smiling_face: