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

Commit c7671687 by Mick Hansen

fix(instance): .save() with default fields and no .changed() will now result in …

…a noop rather than an empty query
1 parent 47aa62a7
Showing with 3 additions and 0 deletions
......@@ -9,6 +9,7 @@
- [BUG] Fixed bad SQL when updating a JSON attribute with a different `field`
- [BUG] Fixed issue with creating and updating values of a `DataTypes.ARRAY(DataTypes.JSON)` attribute
- [BUG] `Model.bulkCreate([{}], {returning: true})` will now correctly result in instances with primary key values.
- [BUG] `instance.save()` with `fields: []` (as a result of `.changed()` being `[]`) will no result in a noop instead of an empty update query.
#### Backwards compatability changes
- `instance.update()` using default fields will now automatically also save and validate values provided via `beforeUpdate` hooks
......
......@@ -617,6 +617,8 @@ module.exports = (function() {
});
}
}).then(function() {
if (!options.fields.length) return this;
return self.QueryInterface[query].apply(self.QueryInterface, args)
.then(function(result) {
// Transfer database generated values (defaults, autoincrement, etc)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!