Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable UpdateAt decorator in specific query #1693

Closed
1 of 2 tasks
oktapodia opened this issue Sep 5, 2023 · 1 comment
Closed
1 of 2 tasks

Disable UpdateAt decorator in specific query #1693

oktapodia opened this issue Sep 5, 2023 · 1 comment

Comments

@oktapodia
Copy link

oktapodia commented Sep 5, 2023

Disable UpdateAt decorator in specific query

Versions

  • sequelize: 6.32.1
  • sequelize-typescript: 2.1.5
  • typescript: 5.2.2

Issue type

  • bug report
  • feature request

Hello, I am trying to disable the UpdatedAt decorator for a single migration query, I've found the silent: true options but it does not seems to be working fine.

Weird thing is that the query debug does not show that updatedAt update:
Executing (719753b2-8f64-4eca-aa3b-58e79e7e5a98): UPDATE \"users\" SET "is_global"=$1 WHERE "status" != ''

I did try with

    await User.update({ isGlobal: true}, {
      where: {
        status: {
          [Op.ne]: '',
        },
      },
      transaction,
      silent: true
    })
  })

and

   user.isGlobal = true
   await user.save({ transaction, silent: true });

But I am having the same behavior, updatedAt gets updated to the current.

Thanks in advance

@blankstar85
Copy link
Contributor

You probably have in the model definition in your version of sql an auto update. For Mysql:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants