Closed trompx closed 1 week ago
I checked in drizzle-kit, the generated schema has a notNull() while I have clearly not set any notNull in my table declaration. This is a major bug.
In drizzle-kit schema explorer, I have :
userId: char("to_user_id", { length: 12 }).notNull(),
It seems after creating a new project, it is not adding notNull() when not specified, so may be due to a node_modules cache issue. Will reopen if happens again.
What version of
drizzle-orm
are you using?0.31.2 (also not working on 0.30.10)
What version of
drizzle-kit
are you using?0.22.7 (also not working on 0.21.1)
Describe the Bug
I'm trying to create a userId column, fk to users.id but optional (so I don't set the notNull property):
But when I try to insert a value with NULL user_id, I get the error:
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.
Also, in
snapshot.json
:In
generated sql
:Expected behavior
I should be able to set a NULL value
Environment & setup
No response