Updating only updatedAt on a model does not cause an update, even with silent: true
See original GitHub issueWhat are you doing?
person = Person.create({ name: 'Original Name'})
await Person.update({ updatedAt: new Date('02-26-1991')}, {where: { id: person.id }, silent: true})
// [ 0 ]
await person.reload()
await person.updatedAt
// 2019-04-12T20:13:52.923Z
await Person.update({ updatedAt: new Date('02-26-1991'), name: 'A New Name'}, {where: { id: person.id }, silent: true})
Executing (default): UPDATE "Person" SET "updatedAt"=$1,"name"=$2 WHERE "id" = $3
// [ 1 ]
await person.reload()
person.updatedAt
// 1991-02-26T05:00:00.000Z
To Reproduce Steps to reproduce the behavior:
- Create a model Personand an instanceperson
- Use Person.updateto update only the updatedAt field on person
- Reload personto see that updatedAt has not been updated
What do you expect to happen?
I expected updatedAt to be updated,
What is actually happening?
updatedAt was not updated
Environment
Dialect:
- mysql
- postgres
- sqlite
- mssql
- any Dialect library version: XXX Database version: PostgreSQL 9.6 Sequelize version: 5.10.0 Node Version: 10.15.3 OS: Ubuntu 18.04.1 on Windows 10 Tested with latest release:
- No
- Yes, specify that version: 5.10.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
 Top Results From Across the Web
Top Results From Across the Web
How to exclude updatedAt in sequelize when updating row
I have researched a little, with "silent:true" and some other suggestion. But I cannot make it to work. The "updatedAt" is till being...
Read more >Use ->update() without updating timestamps - Laracasts
So I have a query that updates many hundreds of rows at a time, eg. Model::where('something', '=', $something)->update(['status' => 'Unallocated']);.
Read more >Updatemany updates the updatedAt timestamp (using ...
Updatemany updates the updatedAt timestamp (using Mongoose) of all the records. Does it make it slow as it needs to go through all...
Read more >sequelize timestamp false | The AI Search Engine You Control
Use the silent option for MyModel.update() . From the docs: [options.silent=false] Boolean If true, the updatedAt timestamp will not be updated ...
Read more >lib/model.js | Sequelize
* @param {boolean} [options.silent=false] If true, the updatedAt timestamp will not be updated. * @param {boolean} [options.validate=true] ...
Read more > Top Related Medium Post
Top Related Medium Post
No results found
 Top Related StackOverflow Question
Top Related StackOverflow Question
No results found
 Troubleshoot Live Code
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free Top Related Reddit Thread
Top Related Reddit Thread
No results found
 Top Related Hackernoon Post
Top Related Hackernoon Post
No results found
 Top Related Tweet
Top Related Tweet
No results found
 Top Related Dev.to Post
Top Related Dev.to Post
No results found
 Top Related Hashnode Post
Top Related Hashnode Post
No results found

I only use it while doing tests for some filtering of data by updatedAt times.
I think it was introduced as a side effect of https://github.com/sequelize/sequelize/pull/10248, which was to prevent updating the updatedAt time when
Model.update({ }, { where: { id: someId } })was called, as this used to behave like I expect it to.Duplicate of #3759