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

Commit 68d729d8 by Martin Gutfeldt Committed by Sushant

fix(model): set previous values in instances from bulkCreate (#8788)

1 parent b0bd34df
...@@ -2403,6 +2403,8 @@ class Model { ...@@ -2403,6 +2403,8 @@ class Model {
instance.set(attr, instance.dataValues[this.rawAttributes[attr].field]); instance.set(attr, instance.dataValues[this.rawAttributes[attr].field]);
delete instance.dataValues[this.rawAttributes[attr].field]; delete instance.dataValues[this.rawAttributes[attr].field];
} }
instance._previousDataValues[attr] = instance.dataValues[attr];
instance.changed(attr, false);
} }
instance.isNewRecord = false; instance.isNewRecord = false;
}); });
......
...@@ -443,6 +443,11 @@ describe(Support.getTestDialectTeaser('DAO'), () => { ...@@ -443,6 +443,11 @@ describe(Support.getTestDialectTeaser('DAO'), () => {
expect(user.changed('name')).to.be.false; expect(user.changed('name')).to.be.false;
expect(user.changed()).not.to.be.ok; expect(user.changed()).not.to.be.ok;
}); });
}).then(() => {
return User.bulkCreate([{name: 'Jan Meier'}]).spread(user => {
expect(user.changed('name')).to.be.false;
expect(user.changed()).not.to.be.ok;
});
}); });
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!