© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•4mo ago
Periapt

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
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Type error when using `drizzle-zod` with sqlite table schema
Drizzle TeamDTDrizzle Team / help
9mo ago
Issue with drizzle-zod?
Drizzle TeamDTDrizzle Team / help
3y ago
drizzle-zod insert/update schema refinements type
Drizzle TeamDTDrizzle Team / help
11mo ago
Drizzle-Zod extend schema....
Drizzle TeamDTDrizzle Team / help
14mo ago