createInsertSchema & createSelectSchema difference

I am using drizzle-zod along with sveltekit-superforms and thoroughly enjoying the combo so far. One question I have is that what is the fundamental difference between the two functions above. I didn't find any related questions or documentation. I think they are mostly the same. taking in a drizzle schema and returning a zod object. Is it just a difference in semantics? I'll appreciate any input on this.
3 Replies
FelixNg
FelixNgOP13mo ago
And how about schema to delete or update?
균어
균어13mo ago
in delete you only need an id to delete update you can use createInsertSchema(table).partial()
FelixNg
FelixNgOP13mo ago
Yeah that would be the normal way to do CRUD schemas. I’m actually talking about the difference between the two specific functions shown in drizzle-zod documentation
Want results from more Discord servers?
Add your server