Skip to content

Commit

Permalink
Merge branch 'master' of github.com:balderdashy/waterline
Browse files Browse the repository at this point in the history
  • Loading branch information
mikermcneil committed Oct 1, 2017
2 parents 4d960d9 + a5889f6 commit e4f9687
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions lib/waterline/utils/query/process-all-records.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {
console.warn('\n'+
'Warning: A database adapter should never send back records that have `undefined`\n'+
'on the RHS of any property (e.g. `foo: undefined`). But after transforming\n'+
'columnNames back to attribute names, one of the records sent back from this adapter\n'+
'has a property (`'+key+'`) with `undefined` on the right-hand side.\n'+
'columnNames back to attribute names for the model `' + modelIdentity + '`, one\n'+
'of the records sent back from this adapter has a property (`'+key+'`) with\n'+
'`undefined` on the right-hand side.\n' +
WARNING_SUFFIXES.HARD_TO_SEE_HOW_THIS_COULD_BE_YOUR_FAULT
);
}//>-
Expand Down Expand Up @@ -224,8 +225,8 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {
console.warn('\n'+
'Warning: Records sent back from a database adapter should always have a valid property\n'+
'that corresponds with the primary key attribute (`'+WLModel.primaryKey+'`). But in this result set,\n'+
'after transforming columnNames back to attribute names, there is a record with\n'+
'a missing or invalid `'+WLModel.primaryKey+'`.\n'+
'after transforming columnNames back to attribute names for model `' + modelIdentity + '`,\n'+
'there is a record with a missing or invalid `'+WLModel.primaryKey+'`.\n'+
'Record:\n'+
'```\n'+
util.inspect(record, {depth:5})+'\n'+
Expand Down Expand Up @@ -364,8 +365,8 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {

if (!isProbablyValidTimestamp) {
console.warn('\n'+
'Warning: After transforming columnNames back to attribute names, a record\n'+
'in the result has a value with an unexpected data type for property `'+attrName+'`.\n'+
'Warning: After transforming columnNames back to attribute names for model `' + modelIdentity + '`,\n'+
' a record in the result has a value with an unexpected data type for property `'+attrName+'`.\n'+
'The model\'s `'+attrName+'` attribute declares itself an auto timestamp with\n'+
'`type: \''+attrDef.type+'\'`, but instead of a valid timestamp, the actual value\n'+
'in the record is:\n'+
Expand Down Expand Up @@ -420,8 +421,8 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {

if (_.isNull(record[attrName])) {
console.warn('\n'+
'Warning: After transforming columnNames back to attribute names, a record\n'+
'in the result has a value of `null` for property `'+attrName+'`.\n'+
'Warning: After transforming columnNames back to attribute names for model `' + modelIdentity + '`,\n'+
' a record in the result has a value of `null` for property `'+attrName+'`.\n'+
'Since the `'+attrName+'` attribute declares `type: \''+attrDef.type+'\'`,\n'+
'without ALSO declaring `allowNull: true`, this `null` value is unexpected.\n'+
'(To resolve, either change this attribute to `allowNull: true` or update\n'+
Expand All @@ -431,8 +432,8 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {
}
else {
console.warn('\n'+
'Warning: After transforming columnNames back to attribute names, a record\n'+
'in the result has a value with an unexpected data type for property `'+attrName+'`.\n'+
'Warning: After transforming columnNames back to attribute names for model `' + modelIdentity + '`,\n'+
' a record in the result has a value with an unexpected data type for property `'+attrName+'`.\n'+
'The corresponding attribute declares `type: \''+attrDef.type+'\'` but instead\n'+
'of that, the actual value is:\n'+
'```\n'+
Expand Down Expand Up @@ -481,8 +482,8 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {
// // (We'd also need to make sure this wasn't deliberately exluded by custom projections
// // before logging this warning.)
// console.warn('\n'+
// 'Warning: After transforming columnNames back to attribute names, a record in the\n'+
// 'result contains an unexpected value (`'+util.inspect(record[attrName],{depth:1})+'`)`\n'+
// 'Warning: After transforming columnNames back to attribute names for model `' + modelIdentity + '`,\n'+
// 'a record in the result contains an unexpected value (`'+util.inspect(record[attrName],{depth:1})+'`)`\n'+
// 'for its `'+attrName+'` property. Since `'+attrName+'` is a required attribute,\n'+
// 'it should never be returned as `null` or empty string. This usually means there\n'+
// 'is existing data that was persisted some time before the `'+attrName+'` attribute\n'+
Expand Down

0 comments on commit e4f9687

Please sign in to comment.