pvman
Explore posts from serversDTDrizzle Team
•Created by pvman on 6/10/2024 in #help
Cannot set null value to FK - null value in column "X" of relation "Y" violates not-null constraint
Hi everyone, I'm trying to create a userId column, fk to users.id but optional (so I don't set the notNull property):
userId: char("user_id", {
length: 12,
}).references(() => users.id),
But when I try to insert a value with NULL user_id, I get the error:
null value in column "user_id" of relation "notifications" violates not-null constraint
I've read that we're supposed to be able set null as fk if notNull is not present.
I also tried with every combination of onDelete/onUpdate (set null, cascade etc.) but nothing works. Any idea?
1 replies
DTDrizzle Team
•Created by pvman on 6/3/2024 in #help
Losing kysely types (using Kyselify) - getting [x: string]: any
Hello.
I have some types problems using kysely with drizzle. I have the following config:
When I do the following query:
In vscode, I get the following type:
It doesn't infer the title and id types automatically so I have a bunch of type error in my code when using posts returned value. Am I doing something wrong or there is a problem with Kyselify?
1 replies
DTDrizzle Team
•Created by pvman on 6/2/2024 in #help
Reusable pgTable column helper - losing type : [x: string] instead of user_id
Hi, I am trying to create a reusable column to use accross multiple tables. If I use the following :
I get the correct type in my KyselyDatabase interface.
user_id: ColumnType<string, string, string>;
I'd like it to be a function instead. But when I do the following :
I get the following type (thus breaking types accross all my db queries)
[x: string]: ColumnType<string | null, string, string>;
6 replies
> Error: Invariant: headers() expects to have requestAsyncStorage, none available
Hi, I use trpc v1045.1 in next 14.1 app router. I call it server side and have the following.
It is working on a static route but on a dynamic route
/edit/[slug]
I get the following error (coming from the headers() in createServerApi):
Error: Invariant: headers() expects to have requestAsyncStorage, none availableAny idea how I could solve this?
8 replies