Sunday, 15 April 2012

sails.js unable to lift sails version 0.9.9 and sails-postgresql version 0.9.7 -



sails.js unable to lift sails version 0.9.9 and sails-postgresql version 0.9.7 -

i not able lift sails version 0.9.9 postgresql version 0.9.7

here error message

debug: lowering sails...

/home/mandeep/iqr/thirstt/node_modules/sails-postgresql/lib/query.js:285 if(self._schema[key].type === 'text') casesensitive = false; ^ typeerror: cannot read property 'type' of undefined @ object.sql.and (/home/mandeep/iqr/thirstt/node_modules/sails-postgresql/lib/query.js:285:27) @ /home/mandeep/iqr/thirstt/node_modules/sails-postgresql/lib/query.js:256:19 @ array.foreach (native) @ [object object].query.where (/home/mandeep/iqr/thirstt/node_modules/sails-postgresql/lib/query.js:195:24) @ /home/mandeep/iqr/thirstt/node_modules/sails-postgresql/lib/query.js:119:14 @ array.foreach (native) @ [object object].query._build (/home/mandeep/iqr/thirstt/node_modules/sails-postgresql/lib/query.js:115:32) @ [object object].query.find (/home/mandeep/iqr/thirstt/node_modules/sails-postgresql/lib/query.js:35:21) @ __find__ (/home/mandeep/iqr/thirstt/node_modules/sails-postgresql/lib/adapter.js:362:40) @ after (/home/mandeep/iqr/thirstt/node_modules/sails-postgresql/lib/adapter.js:506:7) @ /home/mandeep/iqr/thirstt/node_modules/sails-postgresql/lib/adapter.js:492:7

it running fine earlier. not sure went wrong. have tried removing node_modules directory , doing npm install after npm cache clear still maintain getting error. cannot upgrade sails version 0.10 since quite big project , upgrade big effort. how can prepare issue in same version ? help appreciated.

i figured out issue. seems sails-postgresql issue me. doing findone on model in config/bootstrap.js , failing when there no record in table

here part fails ( node_modules/sails-postgresql/lib/query.js ):

query.prototype.operators = function() { var self = this; var sql = { and: function(key, options, comparator) { var casesensitive = true; // check if key string if(self._schema[key].type === 'text') casesensitive = false; processcriteria.call(self, key, options, '=', casesensitive); self._query += (comparator || ' , '); },

i logged value of self. when info exists in table queried in bootstrap.js, self looks this

{ _values: [ 2, 1, 'mon, 29 sep 2014 09:46:08 gmt', 'thu, 06 nov 2014 08:24:34 gmt' ], _paramcount: 5, _query: 'update "cache" set "val" = $1, "id" = $2, "createdat" = $3, "updatedat" = $4 ', _schema: { val: { type: 'integer' }, id: { type: 'integer', primarykey: true, autoincrement: true }, createdat: { type: 'timestamp time zone' }, updatedat: { type: 'timestamp time zone' } } }

however, when there no info in table, self looks this

{ _values: [], _paramcount: 1, _query: 'select * "cache" ', _schema: true }

and accesses self._schema[key].type raises error since self._schema not object in case. on inserting info table, things got fixed believe it's logical bug in sails-postgresql since should work fine if there no info in table.

postgresql sails.js waterline sails-postgresql

No comments:

Post a Comment