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

Commit 27987383 by Ruben Bridgewater

Fix regression introduced in 2.1.2

1 parent 8ec1bf5f
# next
- [BUG] Fix regression introduced in 2.1.2: updatedAt not set anymore
# 2.1.2
- [BUG] `Model.create()/update()` no longer attempts to save undefined fields.
......
......@@ -1630,7 +1630,11 @@ module.exports = (function() {
}
});
} else {
var updatedAtAttr = this._timestampAttributes.updatedAt;
options.fields = _.intersection(Object.keys(values), Object.keys(this.tableAttributes));
if (updatedAtAttr && options.fields.indexOf(updatedAtAttr) === -1) {
options.fields.push(updatedAtAttr);
}
}
if (this._timestampAttributes.updatedAt) {
......
......@@ -165,7 +165,6 @@ var Utils = module.exports = {
if (dataValues[attr] !== undefined && !Model._isVirtualAttribute(attr)) {
values[attr] = dataValues[attr];
// Field name mapping
if (Model.rawAttributes[attr] && Model.rawAttributes[attr].field && Model.rawAttributes[attr].field !== attr) {
values[Model.rawAttributes[attr].field] = values[attr];
......
......@@ -18,7 +18,7 @@ describe(Support.getTestDialectTeaser('Model'), function() {
}
});
return Account.sync({force: true, logging: console.log}).then(function () {
return Account.sync({force: true}).then(function () {
return Account.create({
ownerId: 2
}).then(function (account) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!