Reputation: 2132
What DB I am using?
What do I need?
.update({ name: 'Middle Earth' })
method I need to
automatically update also a timestamp in my table.Upvotes: 4
Views: 9062
Reputation: 2132
create extension if not exists moddatetime schema extensions;
-- assuming the table name is "todos", and a timestamp column "updated_at"
-- this trigger will set the "updated_at" column to the current timestamp for every update
create trigger handle_updated_at before update on todos
for each row execute procedure moddatetime (updated_at);
moddatetime
extension?This stackoverflow question will give you an answer.
Upvotes: 11