diff --git a/drizzle-zod/src/schema.types.internal.ts b/drizzle-zod/src/schema.types.internal.ts index 1acee0803c..7f1ae2df38 100644 --- a/drizzle-zod/src/schema.types.internal.ts +++ b/drizzle-zod/src/schema.types.internal.ts @@ -26,7 +26,12 @@ type HandleRefinement< TColumn extends Column, > = TRefinement extends (schema: any) => z.ZodType ? (TColumn['_']['notNull'] extends true ? ReturnType : z.ZodNullable>) extends infer TSchema extends z.ZodType - ? TType extends 'update' ? z.ZodOptional : TSchema + ? TType extends 'update' ? z.ZodOptional + : TType extends 'insert' + ? TColumn['_']['notNull'] extends true + ? TColumn['_']['hasDefault'] extends true ? z.ZodOptional : TSchema + : z.ZodOptional + : TSchema : z.ZodType : TRefinement;