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

Commit a952132d by Mick Hansen

fix(plugins): have counter-cache use correct way of defining default values

1 parent f61ada76
Showing with 5 additions and 8 deletions
...@@ -45,16 +45,13 @@ module.exports = (function() { ...@@ -45,16 +45,13 @@ module.exports = (function() {
newAttributes[this.columnName] = { newAttributes[this.columnName] = {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: false allowNull: false,
defaultValue: Utils._.partial(
Utils.toDefaultValue,
0
)
}; };
// apparently you can't set defaultValues after model definition
this.source._defaultValues[this.columnName] = Utils._.partial(
Utils.toDefaultValue,
0
);
this.source._hasDefaultValues = true;
Utils.mergeDefaults(this.source.rawAttributes, newAttributes); Utils.mergeDefaults(this.source.rawAttributes, newAttributes);
// Sync attributes and setters/getters to DAO prototype // Sync attributes and setters/getters to DAO prototype
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!