gpt4 book ai didi

sequelize.js - Sequelize : temporarily disable timestamps

转载 作者:行者123 更新时间:2023-12-03 22:23:57 30 4
gpt4 key购买 nike

Sequelize.js 有没有办法暂时禁用时间戳,最好是单个查询?

特别是,我正在运行一个查询

MyModel.update({
UserId: 1
}, {
where: {
UserId: 2
}
}).then(...)

我不希望时间戳更新。我确实希望他们针对与此上下文无关的任何其他查询进行更新。

我已经尝试在运行 MyModel.options.timestamps = false 之前设置 update() 并在之后立即将其设置回 true,而且我也尝试过,只是为了试验,不再将其设置回 true。时间戳仍然会更新。

最佳答案

silent 使用 MyModel.update() 选项。

docs :

[options.silent=false] Boolean If true, the updatedAt timestamp will not be updated.

关于sequelize.js - Sequelize : temporarily disable timestamps,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35856637/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com