Hunter
Explore posts from serversTTCTheo's Typesafe Cult
•Created by Hunter on 7/27/2023 in #questions
Pattern for Prisma Generated Types are not Serializable
I'm looking for a pattern that will help me deal with the types Prisma generates that are not serializable.
The primary culprit is columns with a
DateTime
type which translates to the Date
type on a TypeScript type.
The is either at build time using GetStaticProps
or run time using GetServerSideProps
. And the error will be
Example Prisma model that causes this problem:
React Page component that causes the error:
Prisma can't generate the DateTime type as a date string: https://github.com/prisma/prisma/discussions/5522
I can just create duplicate types that mirror the Prisma types but with Date
fields replaced with String
fields. This really sucks. I don't want to manage multiple copies of types.
My goal:
Be able to run a prisma query(from GetServerSideProps or GetStaticProps) and pass the resulting value directly to my page props using the types generated from my schema.3 replies
WWasp-lang
•Created by Hunter on 6/16/2023 in #🙋questions
Does Wasp support MySQL?
Clearly PrismaJS does. Looking at wasps docs on databases: https://wasp-lang.dev/docs/language/features#database
It says clearly that either
sqlite
or postgresql
can be used. Is the documentation just missing or is MySQL truly not supported by wasp?
My hope is to use planetscale.com to host our database. And it is based on MySQL so that may be an issue.15 replies