我怎么知道钩子afterBulkUpdate()里面的实例用户是否更新了?
UserController.js
const [isUpdated] = await User.update(
    fields,
    {where}
);
// Where I know if updated or not! isUpdated is 1 when updated, 0 when not updatedUser.js
// But inside a Model how I know if updated or not?
User.addHook('afterBulkUpdate', (options) => {
    // user.isUpdated?
});我不能使用afterUpdate(),甚至像这样使用individualHooks: true:
UserController.js
const [isUpdated] = await User.update(
    fields,
    {where, individualHooks: true}
);我正在使用MySQL。有什么解决方案吗?
发布于 2021-03-07 02:33:36
const user = sequelize.define("user",
    {
      first_name: { type: DataTypes.STRING, trim: true },
      ...
     
    },
      hooks: {
        // afterUpdate(instance, options) {
        //   let changed = instance._changed;
        //   console.log(changed, options);
        // }
      },
    }
  );https://stackoverflow.com/questions/66509135
复制相似问题