From f72897844e82b19bcaa5f6fad75bd18a6843c188 Mon Sep 17 00:00:00 2001 From: falconscript Date: Tue, 16 Oct 2018 19:41:41 -0700 Subject: [PATCH 1/2] Allow 0 to be a valid UNIX timestamp. Issuing console warnings for timestamp of 0 isn't necessary and are sometimes used to represent "unset" programmatically since datetimes must be type 'ref' and 'ref' cannot be null. Removing the if check will allow them to pass through in auto-migrations without spurring messages. --- lib/waterline/utils/query/process-all-records.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/waterline/utils/query/process-all-records.js b/lib/waterline/utils/query/process-all-records.js index a70e0c1a0..fc5b7d828 100644 --- a/lib/waterline/utils/query/process-all-records.js +++ b/lib/waterline/utils/query/process-all-records.js @@ -221,7 +221,6 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) { // Do quick, incomplete verification that a valid primary key value was sent back. var isProbablyValidPkValue = ( record[attrName] !== '' && - record[attrName] !== 0 && ( _.isString(record[attrName]) || _.isNumber(record[attrName]) ) From 635842942203b9ea5a7d7c4a39bdfcce6e1d3b06 Mon Sep 17 00:00:00 2001 From: falconscript Date: Tue, 16 Oct 2018 19:50:46 -0700 Subject: [PATCH 2/2] Clear the right check --- lib/waterline/utils/query/process-all-records.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/waterline/utils/query/process-all-records.js b/lib/waterline/utils/query/process-all-records.js index fc5b7d828..97ca2bbbf 100644 --- a/lib/waterline/utils/query/process-all-records.js +++ b/lib/waterline/utils/query/process-all-records.js @@ -221,6 +221,7 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) { // Do quick, incomplete verification that a valid primary key value was sent back. var isProbablyValidPkValue = ( record[attrName] !== '' && + record[attrName] !== 0 && ( _.isString(record[attrName]) || _.isNumber(record[attrName]) ) @@ -362,7 +363,6 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) { // Do quick, very incomplete verification that a valid timestamp was sent back. var isProbablyValidTimestamp = ( record[attrName] !== '' && - record[attrName] !== 0 && ( _.isString(record[attrName]) || _.isNumber(record[attrName]) || _.isDate(record[attrName]) )