Closed Celadora closed 7 years ago
It turns out that afterUpdate is not triggered if the model is unchanged - but that is just something I discovered when fumbling about while trying to solve this problem.
I've retested with new data for each update (ensuring the model is in fact updated), and if options.raw = true then afterUpdate is still not triggered.
Perhaps this is because options.raw: true doesn't create an instance that afterUpdate can use, but I'm using options.raw: true so that I can pass along values that will be altered before the update ultimately happens. However there should be an instance available since the update method is a prototype on the instance.
I'm closing this as I've found a better solution. I should have been using a virtual setter for my particular use case. http://docs.sequelizejs.com/manual/tutorial/models-definition.html#getters-setters
What you are doing?
updating an instance with option.raw = true
What do you expect to happen?
I expect the afterUpdate hook to be triggered.
What is actually happening?
The hook isn't being triggered