Open RobertCZ opened 7 months ago
@RobertCZ thanks for the request but sadly this is not possbile yet, because these field types are currently not present in the prisma.dmmf
which is the source of truth for all generated prisma types and also our generated schemas. 😢
Thank you. Created question https://github.com/prisma/prisma/issues/22157
@chrishoermann I proposed a workaround in the Prisma issue that I've been using in my own custom generator that might interest you: https://github.com/prisma/prisma/issues/10252#issuecomment-1962758703
Perhaps you can make use of the same method to generate better Zod schemas!
Not sure if this is already possible and I just missed it in the docs but how about supporting database specific field types?
Eg Prisma already generates for MS SQL field
TinyInt
It would be nice to say somewhere that
Int @db.TinyInt
should be mapped totinyint()
and generate automaticallyfor Zod with some db specific validators eg
const tinyint = () => z.number().int().min(0).max(255)