fix sql error when initializing models with empty Number property. It should return NULL when a number is empty
This commit is contained in:
parent
9e2b9e1272
commit
e1bd92b52a
|
@ -164,7 +164,18 @@ PG.prototype.toDatabase = function (prop, val) {
|
|||
return this.toDatabase(prop, val[0]) + ' AND ' + this.toDatabase(prop, val[1]);
|
||||
}
|
||||
}
|
||||
if (prop.type.name === 'Number') return val;
|
||||
if (prop.type.name === 'Number') {
|
||||
if (!val) {
|
||||
if( prop.autoIncrement ) {
|
||||
return 'DEFAULT';
|
||||
}
|
||||
else {
|
||||
return 'NULL';
|
||||
}
|
||||
}
|
||||
return val
|
||||
};
|
||||
|
||||
if (prop.type.name === 'Date') {
|
||||
if (!val) {
|
||||
if( prop.autoIncrement ) {
|
||||
|
|
Loading…
Reference in New Issue