Is there currently a way to utilize onUpdate?
Trying to run
ON UPDATE NOW()
for a last_updated
column for whenever the row is changed.5 Replies
There's an
.onUpdateNow()
methodFYI, this is not mentioned in the docs anywhere.
Fair
It's visible via the method autocompletion though
The docs will be improved significantly once we prepare the website
awesome I'll give it a shot!
updatedAt: timestamp('updated_at', { mode: 'date', precision: 3 })
.defaultNow()
.$onUpdate(() => sql
(now() AT TIME ZONE 'UTC')
)
.notNull(),
can we add .$onUpdate(() => sql(now() AT TIME ZONE 'UTC')
) this?