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

Commit 155e8adc by Mick Hansen

Merge pull request #2271 from seth-admittedly/feature/paranoid-after-destroy

Save deletedAt without hooks but maintain hooks option for afterDestroy
2 parents bfc083d3 c907ed02
Showing with 1 additions and 2 deletions
......@@ -739,8 +739,7 @@ module.exports = (function() {
if (self.Model._timestampAttributes.deletedAt && options.force === false) {
self.dataValues[self.Model._timestampAttributes.deletedAt] = new Date();
options.hooks = false;
return self.save(options);
return self.save(_.extend(_.clone(options), {hooks : false}));
} else {
identifier = self.__options.hasPrimaryKeys ? self.primaryKeyValues : { id: self.id };
return self.QueryInterface.delete(self, self.QueryInterface.QueryGenerator.addSchema(self.Model), identifier, options);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!