Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support native database filed types #214

Open
RobertCZ opened this issue Nov 24, 2023 · 3 comments
Open

Support native database filed types #214

RobertCZ opened this issue Nov 24, 2023 · 3 comments

Comments

@RobertCZ
Copy link

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

UseFee Int @db.TinyInt

It would be nice to say somewhere that Int @db.TinyInt should be mapped to tinyint() and generate automatically

UseFee: tinyint()

for Zod with some db specific validators eg const tinyint = () => z.number().int().min(0).max(255)

@chrishoermann
Copy link
Owner

@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. 😢

@RobertCZ
Copy link
Author

Thank you. Created question prisma/prisma#22157

@AlexanderArvidsson
Copy link

@chrishoermann I proposed a workaround in the Prisma issue that I've been using in my own custom generator that might interest you:
prisma/prisma#10252 (comment)

Perhaps you can make use of the same method to generate better Zod schemas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants