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
Dan
Dan2y ago
There's an .onUpdateNow() method
JT
JT2y ago
FYI, this is not mentioned in the docs anywhere.
Dan
Dan2y ago
Fair It's visible via the method autocompletion though The docs will be improved significantly once we prepare the website
Cory
CoryOP2y ago
awesome I'll give it a shot!
Md Jahidul Islam milon
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?
Want results from more Discord servers?
Add your server