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

populate with "_autogenerated" flag all built-in attributes

1 parent e2387294
Showing with 16 additions and 5 deletions
...@@ -126,7 +126,7 @@ module.exports = (function() { ...@@ -126,7 +126,7 @@ module.exports = (function() {
this._timestampAttributes.createdAt = Utils._.underscoredIf(this.options.createdAt, this.options.underscored) this._timestampAttributes.createdAt = Utils._.underscoredIf(this.options.createdAt, this.options.underscored)
} }
if (this.options.updatedAt) { if (this.options.updatedAt) {
this._timestampAttributes.updatedAt = Utils._.underscoredIf(this.options.updatedAt, this.options.underscored) this._timestampAttributes.updatedAt = Utils._.underscoredIf(this.options.updatedAt, this.options.underscored)
} }
if (this.options.paranoid && this.options.deletedAt) { if (this.options.paranoid && this.options.deletedAt) {
this._timestampAttributes.deletedAt = Utils._.underscoredIf(this.options.deletedAt, this.options.underscored) this._timestampAttributes.deletedAt = Utils._.underscoredIf(this.options.deletedAt, this.options.underscored)
...@@ -598,7 +598,7 @@ module.exports = (function() { ...@@ -598,7 +598,7 @@ module.exports = (function() {
DAOFactory.prototype.count = function(options) { DAOFactory.prototype.count = function(options) {
options = Utils._.clone(options || {}) options = Utils._.clone(options || {})
return new Utils.CustomEventEmitter(function (emitter) { return new Utils.CustomEventEmitter(function (emitter) {
var col = this.sequelize.col('*') var col = this.sequelize.col('*')
if (options.include) { if (options.include) {
...@@ -1332,13 +1332,24 @@ module.exports = (function() { ...@@ -1332,13 +1332,24 @@ module.exports = (function() {
} }
if (this._timestampAttributes.createdAt) { if (this._timestampAttributes.createdAt) {
tail[this._timestampAttributes.createdAt] = {type: DataTypes.DATE, allowNull: false} tail[this._timestampAttributes.createdAt] = {
type: DataTypes.DATE,
allowNull: false,
_autoGenerated: true,
}
} }
if (this._timestampAttributes.updatedAt) { if (this._timestampAttributes.updatedAt) {
tail[this._timestampAttributes.updatedAt] = {type: DataTypes.DATE, allowNull: false} tail[this._timestampAttributes.updatedAt] = {
type: DataTypes.DATE,
allowNull: false,
_autoGenerated: true,
}
} }
if (this._timestampAttributes.deletedAt) { if (this._timestampAttributes.deletedAt) {
tail[this._timestampAttributes.deletedAt] = {type: DataTypes.DATE} tail[this._timestampAttributes.deletedAt] = {
type: DataTypes.DATE,
_autoGenerated: true,
}
} }
var existingAttributes = Utils._.clone(self.rawAttributes) var existingAttributes = Utils._.clone(self.rawAttributes)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!