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
5 Replies
the type of the id field itself contains the NotNull generic too.. 🤔
Bug? I think the safest thing is to use .notNull()
same thing 🤔
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
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.