From 58ddd958cbdb8ca3f9f7410271909ae228c6d941 Mon Sep 17 00:00:00 2001 From: eerenyuan Date: Sun, 16 Sep 2018 01:44:43 +0800 Subject: [PATCH] handle manually set update ts so the create and update are having the same logic of 3 conditions: a. key given; b. new model / value changed; c. ts not manually set; --- lib/base/model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/base/model.js b/lib/base/model.js index bf3d2848..e2b0ca5e 100644 --- a/lib/base/model.js +++ b/lib/base/model.js @@ -643,7 +643,7 @@ ModelBase.prototype.timestamp = function(options) { const updatedAtKey = timestampKeys[1]; const isNewModel = method === 'insert'; - if (updatedAtKey && (isNewModel || this.hasChanged())) { + if (updatedAtKey && (isNewModel || this.hasChanged()) && !this.hasChanged(updatedAtKey) ) { attributes[updatedAtKey] = now; }