fix: return generated: false if the connector doesnot return it

Signed-off-by: Muhammad Aaqil <aaqilcs102@gmail.com>
This commit is contained in:
Muhammad Aaqil 2024-02-05 14:11:52 +05:00 committed by Samarpan Bhattacharya
parent 901486f0d3
commit 748fe22bcb
2 changed files with 15 additions and 15 deletions

View File

@ -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,
};
});

View File

@ -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',