© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
Creating zod insert schema from Query with relations - Drizzle Team
DT
Drizzle Team
•
3y ago
mr_pablo
Creating zod insert schema from Query with relations
I am using a Query FindFirst
, with multiple relations enabled
. I can infer the schema from this using
Awaited<ReturnType<typeof myQuery['execute']>>
Awaited<ReturnType<typeof myQuery['execute']>>
but this includes the ID field in the relational objects
.
How can I create a type that matches the query schema
, but minus the IDs in the relations
?
Bonus question
, how can I then use Zod to add this type into a zod schema object
?
Drizzle Team
Join
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,959
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
Drizzle-zod insert schema list
DT
Drizzle Team / help
10mo ago
drizzle-zod: remove ID from insert schema type
DT
Drizzle Team / help
3y ago
Drizzle Zod with relations
DT
Drizzle Team / help
2y ago
insert returning relations
DT
Drizzle Team / help
3y ago