*SDK question*: does the <DMMF> not include data s...
# orm-help
j
SDK question: does the DMMF not include data source specific types? I am writing a generator and want
@db.VarChar(25)
, for example, to emit code to warn/trim/whatever on more than 25 characters but none of the
@db.
annotations are present in the DMMF. I can only see the field is a
String
. Is there another way to get this information?
I couldn't find a solution in Prisma code so I wrote this little parser that reads
schema.prisma
and returns a simple object mapping model fields to the db type, e.g.
Copy code
Profile: {
    name: { type: 'VarChar', size: 25 },
    userId: { type: 'UnsignedInt' }
}
a
Hey @Jason Abbott! Our engineering team is looking at this one and I will get back to you with their findings. We are excited that you are exploring a custom generator! Would you mind telling me more about your use case?
j
@Austin My use case is a temporary mitigation. I have a TS monorepo deploying to Vercel. Prisma config is shared by the packages so not within their folders. Although it works fine locally, the deployed Prisma client cannot find the schema file. I tried several things to make it work without success (see issue 9520). As those efforts grew in complexity, I realized it would be simpler just to generate my own client. 🤷‍♂️ I like the Prisma migration and modeling enough to want to keep those even if I don't use the client bits. Instead, I generate my own, much simpler (1K instead of 41K lines!) client, which gives me nice TS for the basic CRUD but requires I write SQL for joins and such. I am happy with this compromise for now since it also has the benefit of resolving some VSCode perf issues and adding client-side validation I was asking about here.