Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sequelize - update row without altering the updated_at field

I am using sequelize.js library as ORM in node development. When update a row using sequelize, 'updated_at' field changed to current time-stamp. I would like to know how can I prevent this ? Without changing 'updated_at' field I would like to update other fields using sequlize API, not running raw query.

like image 866
iamcrypticcoder Avatar asked Mar 16 '16 09:03

iamcrypticcoder


1 Answers

According to http://docs.sequelizejs.com/class/lib/model.js~Model.html#static-method-update you can use the "silent" option to run an update query but not update the updateAt field.

options.silent Boolean
optional
default: false
If true, the updatedAt timestamp will not be updated.

myModelInstance.update(values, {
    silent: true
})
like image 177
PR1M3 Avatar answered Sep 20 '22 11:09

PR1M3