DT
Drizzle Team•10mo ago
markk

Nullable IDs

Why are pk id fields nullable in drizzle even when they're annotated with .notNull()? Can see here ID is nullable for some reason
No description
5 Replies
markk
markkOP•10mo ago
the type of the id field itself contains the NotNull generic too.. 🤔
No description
BluePin
BluePin•10mo ago
Bug? I think the safest thing is to use .notNull()
markk
markkOP•10mo ago
same thing 🤔
No description
markk
markkOP•10mo ago
I mean on the surface level seems like a bug to me but maybe something fundamental is going over my head ohh because a default is provided hmm that makes for using the type a little interesting
Mykhailo
Mykhailo•10mo ago
Hello @markk @BluePin , it's not a bug, and id cannot be null. It can either be a string or undefined. It might be undefined in the insert type because you've set a default value using the defaultRandom method. If a column has a default value, it can be undefined (optional), because if no value is provided, the default value will be set.
Want results from more Discord servers?
Add your server