[drizzle-zod] How to make all fields of a schema derived from a table required ?

I just tried the plugin and I'm happy to move from manually creating zod schemas.
However, I came into a use case where a schema must have all nullable fields in the table required.

Assume we have these in users table:
  const users = mysqlTable("users", {
  ...
  speciality: varchar('speciality', { length: 255 }),
  level: tinyint('level'),
  ...
});

The generated schema will have this type
type Schema = {
speciality: string | null | undefined,
level: number | null | undefined
}

Is there a way to make it like this ?
type Schema = {
speciality: string ,
level: number 
}
Was this page helpful?