how to set default null to an int column
I want the parentId to have the default Null, how to do that
8 Replies
that's already the default isn't it?
https://orm.drizzle.team/docs/column-types/pg#constraints--defaults
PostgreSQL column types - DrizzleORM
Drizzle ORM | %s
It seems like it's not
are you sure you're not passing a blank string value when inserting?
what happens if you add to the column def?
i added this .default(sql
NULL
). no type error occurs, im pretty sure that im not passing a blank string value,One more thing that, createAt has Null default where i shouldnt be.
createdAt: timestamp('created_at').default(sql
CURRENT_TIMESTAMP
),Did you check the log to see the SQL being generated for insert?
https://orm.drizzle.team/docs/goodies#logging
Goodies - DrizzleORM
Drizzle ORM | %s
Two options:
Thank you very much ,it got fixed now