Skip to content

Updating only updatedAt on a model does not cause an update, even with silent: true #11183

@jamelling

Description

@jamelling

What 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:

  1. Create a model Person and an instance person
  2. Use Person.update to update only the updatedAt field on person
  3. Reload person to 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: understoodFor issues. Applied when the issue is understood / reproducible.type: bugDEPRECATED: replace with the "bug" issue type

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions