Closed dbachrach closed 1 year ago
Thanks for opening this!
Probably the best we could do for now is register it automatically if you have Decimal in your schema.
FWIW I'm also finding that sum(...)
$queryRaw queries across Int (@db.TinyInt) columns are also returning Decimals, so I don't think it needs to be in the schema for it to show up.
What do you want and why?
I noticed that if you use the type
Decimal
in your Prisma schema that the Prisma client usesDecimal.js
instead of just a raw JS number. If you return aDecimal
through a blitz query though the value on the client side is not reserialized back into aDecimal.js
class. I can register this class in_app.tsx
to get superjson to handle this case:Should we do this automatically in Blitz since this is an unexpected gotcha right now? We would probably want to be clever about it though. If you don't ever return a Decimal in a query, then we would be adding the decimal.js library to your client bundle unnecessarily.