Hello, is it possible to write some sort of "smart...
# prisma-client
l
Hello, is it possible to write some sort of "smart update" query?
ra-data-prisma
plugin for React Admin (to connect with Nexus backend) does a thing where you supply new and previous data, it compares them field-wise and only sends a GQL request with setting only new values. So if I have an object
{ id: 1, name: 'John', lastName: 'Doe' }
and I pass a new object
{ id: 1, name: 'John', lastName: 'Smith' }
it automatically sends a query like
{ lastName: { set: 'Smith' } }
and doesn't touch any unchanged fields. Do we have anything like this in Prisma? Or is the "unnecessary update" overhead negligible?
Seems like running SQL update that doesn't actually change anything still has a non-zero impact (the operation still happens regardless of change), so running that carelessly for dozens of rows at a time probably isn't a good idea