define a jsonb column with `{}` as default value does not work
I'm trying to define a jsonb column with default value like this:
however, the inferred type definition of
attrs
still be Record<string, JSONValue> | null
. How to get rid of the null
?Solution:Jump to solution
``ts
attrs: pg
.jsonb('attrs')
.$type<Record<string, JSONValue>>()
.default(sql
'{}'::jsonb`).notNull(),...3 Replies