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

Commit 387dcf4e by Sushant Committed by Mick Hansen

(fix) restore ignore field from deletedAt attr (#6805)

* (fix) restore ignore field from deletedAt attr

* [ci skip] change log
1 parent 92b36ecc
# Future # Future
- [FIXED] `restore` now uses `field` from `deletedAt`
- [FIXED] MSSQL bulkInsertQuery when options and attributes are not passed - [FIXED] MSSQL bulkInsertQuery when options and attributes are not passed
- [FIXED] `DATEONLY` now returns `YYYY-MM-DD` date string [#4858] (https://github.com/sequelize/sequelize/issues/4858) - [FIXED] `DATEONLY` now returns `YYYY-MM-DD` date string [#4858] (https://github.com/sequelize/sequelize/issues/4858)
- [FIXED] Issues with `createFunction` and `dropFunction` (PostgresSQL) - [FIXED] Issues with `createFunction` and `dropFunction` (PostgresSQL)
......
...@@ -2452,7 +2452,7 @@ class Model { ...@@ -2452,7 +2452,7 @@ class Model {
const deletedAtAttribute = this.rawAttributes[deletedAtCol]; const deletedAtAttribute = this.rawAttributes[deletedAtCol];
const deletedAtDefaultValue = deletedAtAttribute.hasOwnProperty('defaultValue') ? deletedAtAttribute.defaultValue : null; const deletedAtDefaultValue = deletedAtAttribute.hasOwnProperty('defaultValue') ? deletedAtAttribute.defaultValue : null;
attrValueHash[deletedAtCol] = deletedAtDefaultValue; attrValueHash[deletedAtAttribute.field || deletedAtCol] = deletedAtDefaultValue;
options.omitNull = false; options.omitNull = false;
return this.QueryInterface.bulkUpdate(this.getTableName(options), attrValueHash, options.where, options, this._timestampAttributes.deletedAt); return this.QueryInterface.bulkUpdate(this.getTableName(options), attrValueHash, options.where, options, this._timestampAttributes.deletedAt);
}).tap(() => { }).tap(() => {
......
...@@ -67,7 +67,8 @@ describe(Support.getTestDialectTeaser('Model'), function () { ...@@ -67,7 +67,8 @@ describe(Support.getTestDialectTeaser('Model'), function () {
}, },
deletedAt: { deletedAt: {
type: DataTypes.DATE, type: DataTypes.DATE,
allowNull: true allowNull: true,
field: 'deleted_at'
} }
}, { }, {
paranoid: true, paranoid: true,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!