deleted_at column to be defaulted empty on creating a new record

How can I have my deleted_at column to be defaulted empty on creating a new record?
deletedAt: timestamp('deleted_at', { mode: 'string' }).default('NULL'),
deletedAt: timestamp('deleted_at', { mode: 'string' }).default('NULL'),
or is this not possible? I'm not adding .defaultNow(), but it seems to do it anyway.
2 Replies
Mykhailo
Mykhailo7mo ago
If you want to deletedAt column be empty (null) you can try this:
deletedAt: timestamp('deleted_at', { mode: 'string' })
deletedAt: timestamp('deleted_at', { mode: 'string' })
It will automatically be set to null
ZAZ
ZAZOP7mo ago
alright thanks, it seems to work now. I had to delete all previous migration files, bc kept getting '
error: invalid input syntax for type timestamp: "NULL"' error
error: invalid input syntax for type timestamp: "NULL"' error
Want results from more Discord servers?
Add your server