drizzle-zod: remove ID from insert schema type

It doesn't seem super clear from the docs, but is there a way to remove autoIncremented values like ids from the schema?
3 Replies
Fil
Fil16mo ago
Could you be more specific? Are you trying to remove the autoincrement constraint or are you trying to remove the attribute all together? Either way you simple remove them from the schema then push your changes.
SteveS
SteveSOP16mo ago
So, I have a schema for a db table. I want to create an insert schema. The ID is auto incremented. I therefore do not need the ID field as part of the insert schema.
MAST
MAST16mo ago
You can use .omit after creating the schema and ignore it. You can checkout Zod's docs for examples.

Did you find this page helpful?