diff --git a/lib/datasource.js b/lib/datasource.js index 39645b45..33e9add5 100644 --- a/lib/datasource.js +++ b/lib/datasource.js @@ -1673,7 +1673,7 @@ DataSource.prototype.discoverSchemas = function(tableName, options, cb) { length: item.dataLength, precision: item.dataPrecision, scale: item.dataScale, - generated: item.generated, + generated: item.generated || false, }; if (pks[item.columnName]) { schema.properties[propName].id = pks[item.columnName]; @@ -1685,7 +1685,7 @@ DataSource.prototype.discoverSchemas = function(tableName, options, cb) { dataPrecision: item.dataPrecision, dataScale: item.dataScale, nullable: item.nullable, - generated: item.generated, + generated: item.generated || false, }; // merge connector-specific properties if (item[dbType]) { @@ -1837,7 +1837,7 @@ DataSource.prototype.discoverSchemasSync = function(modelName, options) { length: item.dataLength, precision: item.dataPrecision, scale: item.dataScale, - generated: item.generated, + generated: item.generated || false, }; if (pks[item.columnName]) { @@ -1850,7 +1850,7 @@ DataSource.prototype.discoverSchemasSync = function(modelName, options) { dataPrecision: item.dataPrecision, dataScale: item.dataScale, nullable: i.nullable, - generated: i.generated, + generated: i.generated || false, }; }); diff --git a/test/discovery.test.js b/test/discovery.test.js index 6ce9692f..f537b9ab 100644 --- a/test/discovery.test.js +++ b/test/discovery.test.js @@ -45,7 +45,7 @@ describe('Memory connector with mocked discovery', function() { dataPrecision: null, dataScale: null, nullable: 0, - generated: undefined, + generated: false, }, { owner: 'STRONGLOOP', @@ -56,7 +56,7 @@ describe('Memory connector with mocked discovery', function() { dataPrecision: 10, dataScale: 0, nullable: 1, - generated: undefined, + generated: false, }, { owner: 'STRONGLOOP', @@ -67,7 +67,7 @@ describe('Memory connector with mocked discovery', function() { dataPrecision: 10, dataScale: 0, nullable: 1, - generated: undefined, + generated: false, }]; ds.discoverModelProperties = function(modelName, options, cb) { @@ -234,13 +234,13 @@ describe('Memory connector with mocked discovery', function() { dataScale: 0, dataType: 'int', nullable: 1, - generated: undefined, + generated: false, }, precision: 10, required: false, scale: 0, type: undefined, - generated: undefined, + generated: false, }, locationId: { length: 20, @@ -254,13 +254,13 @@ describe('Memory connector with mocked discovery', function() { dataScale: null, dataType: 'varchar', nullable: 0, - generated: undefined, + generated: false, }, precision: null, required: true, scale: null, type: undefined, - generated: undefined, + generated: false, }, productId: { length: 20, @@ -294,13 +294,13 @@ describe('Memory connector with mocked discovery', function() { dataScale: 0, dataType: 'int', nullable: 1, - generated: undefined, + generated: false, }, precision: 10, required: false, scale: 0, type: undefined, - generated: undefined, + generated: false, }, }, }; @@ -418,7 +418,7 @@ describe('discoverModelProperties', function() { dataPrecision: null, dataScale: null, nullable: 0, - generated: undefined, + generated: false, }, { owner: 'STRONGLOOP', @@ -429,7 +429,7 @@ describe('discoverModelProperties', function() { dataPrecision: null, dataScale: null, nullable: 0, - generated: undefined, + generated: false, }, { owner: 'STRONGLOOP',