word
Explore posts from serversTTCTheo's Typesafe Cult
•Created by word on 7/11/2023 in #questions
Check if unique key exists before create
I'm using react-hook-form with zod validation, and I want to check if a unique key exists on the onBlur field event.
I can't put it inside Zod validation nor can I rely on the server to respond with this error after submission, because planet-scale never knows what column caused the error.
My workaround was to create a trpc route to check if the key exists, call a it's refetch every onBlur event and conditionally use setError to invalidate the field. But this approach is cumbersome and doesn't seem like a good solution.
What could I do instead?
4 replies
TTCTheo's Typesafe Cult
•Created by word on 1/19/2023 in #questions
What to use to generate pdfs?
I've been searching for a couple of days and yet I'm not sure about which lib to use. jsPDF seems like a good option, it does what I need and has types. Any suggestions?
1 replies
TTCTheo's Typesafe Cult
•Created by word on 12/4/2022 in #questions
Strange Prisma error when trying to seed -- meta { column_name 'for' }
I'm trying to seed the following table.
I'm using planet scale as db host and prisma is in relationMode prisma.
I have no errors whatsoever when I seed the tables it's related with. I also have no errors when manually creating rows in it in prisma studio. If I try to create row with prisma.model.create, I get no erros, but also no row.
But if assign the create return value to a variable, then it gives me this error:
There is no such column ( for ) in any table. What could it be?
6 replies