不要怂,就是干,撸起袖子干!

Commit 3b6553e1 by Sébastien Requiem

Doc update

* fix sequelize/sequelize#4777
1 parent 6ef5bdb2
Showing with 5 additions and 0 deletions
......@@ -263,6 +263,11 @@ DELETE FROM `table` WHERE associatedIdentifiier = associatedIdentifier.primaryKe
However, adding `hooks: true` explicitly tells Sequelize that optimization is not of your concern and will perform a `SELECT` on the associated objects and destroy each instance one by one in order to be able to call the hooks with the right parameters.
If your association is of type `n:m`, you may be interested in firing events when using the `remove` call. Internally, sequelize is using `Model.destroy` resulting in calling the `bulkDestroy` instead of the `before/afterDestroy` hooks.
This can be simply solved by passing `{individualHooks: true}` to the `remove` call, resulting on each hook to be called on each removed association object.
## A Note About Transactions
Note that many model operations in Sequelize allow you to specify a transaction in the options parameter of the method. If a transaction _is_ specified in the original call, it will be present in the options parameter passed to the hook function. For example, consider the following snippet:
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!