Hi all, I recently upgraded from Prisma1 to Prism...
# orm-help
b
Hi all, I recently upgraded from Prisma1 to Prisma2, and I just discovered an issue with Floats. Occasionally, a float I send to my backend will appear in my Postgres database with 12 extra 9s after the number I send it. Strangely, when I call this data from the client, it looks fine. During introspection, my Prisma1 Floats were mapped to Prisma2 Floats in my Prisma Schema. I’m not sure that was right, because after some digging it seems Prisma2 Floats are now expecting the double type in Postgres. These data columns in my Postgres are numeric(65, 30) since they were created by Prisma1. I assume my issue involves this mismatch between the Prisma2 generator and my Postgres database. I had no issue with numeric(65, 30). Is there a way to tell my Prisma2 schema that I’m using numeric(65, 30), so it will behave normally? I’d rather not deal with decimal.js or rewrite any existing code. I just want it to behave as before. Thanks, Bailey
j
What happens if you run
npx prisma db pull
on your database? What schema does it produce?
Generally floating types are complicated, and sometimes the visual representation is weird - in the end counts that you get the numbers you expect.
b
It makes them Decimal. That would require I rewrite code to expect decimal.js objects, right?
j
Ah ok, so the problem really is on the Prisma Client, Node/JS/TS side? What type should it be instead?
b
I would rather just get back the number that’s in the database as a javascript float.
j
Ok. Then we already have a feature request about that, let me find it.
Not sure how this is closed though... feel free to comment on the issue and explain your view point.
b
Ah yes, this is the exact issue I have. Thanks for linking it. I hadn’t seen. I’ll echo my request with the others there. Thanks again.
👍 1
j
What is the problem with Decimal.js though btw? (Trying to understand)