Issue with sqlite real type and drizzle-zod schema

Versions used: - drizzle-orm 0.44.5 (sqlite-core) - drizzle-zod 0.8.3 - zod 4.1.12 (also tried latest 3.x) I have a drizzle schema with a field specified as sqlite.real() I've used createSchemaFactory to add coercion to numbers, and am using createInsertSchema from that With that, I try to validate some form data where the real field is filled as a string, e.g. '1.5', in the object The result of parse/safeParse is an error telling me it expects an int, but got a number! When digging a bit through the logged generated schema, the field has "format: safeint" for some reason, and I reckon that's the problem Is there any way I can work around that or is my best bet just writing my own zod schemas? I couldn't find anything by searching on the net aside from a zod "issue" where they made .safe() on numbers force int values in v4, but I've tried changing to v3 and got the same issue. drizzle-zod docs don't mention using .safe() for sqlite.real() anyway, just number and min and max
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?