loopback-connector-mysql
Advanced tools
Comparing version 7.0.13 to 7.0.14
@@ -361,4 +361,4 @@ // Copyright IBM Corp. 2013,2019. All Rights Reserved. | ||
case 'TINYINT': | ||
// treat TINYINT(1) as boolean as it is aliased as BOOL and BOOLEAN in mysql | ||
if (!options.treatTINYINT1AsTinyInt && columnType === 'tinyint(1)') { | ||
// treat TINYINT as boolean as it is aliased as BOOL and BOOLEAN in mysql | ||
if (!options.treatTINYINT1AsTinyInt && columnType.includes('tinyint')) { | ||
return 'Boolean'; | ||
@@ -365,0 +365,0 @@ } |
@@ -631,3 +631,9 @@ // Copyright IBM Corp. 2015,2019. All Rights Reserved. | ||
const idProp = this.getModelDefinition(model).properties[idName]; | ||
if (idProp.generated) { | ||
const idColumnType = this.columnDataType(model, idName); | ||
if (idProp.generated && ( | ||
idColumnType === 'TINYINT' || | ||
idColumnType === 'SMALLINT' || | ||
idColumnType === 'MEDIUMINT' || | ||
idColumnType === 'INT' || | ||
idColumnType === 'BIGINT')) { | ||
sql.push(self.columnEscaped(model, idName) + ' ' + | ||
@@ -768,2 +774,12 @@ self.buildColumnDefinition(model, idName) + ' AUTO_INCREMENT PRIMARY KEY'); | ||
const colScale = columnMetadata && columnMetadata.dataScale; | ||
let enumList = ''; | ||
if (colType && colType === 'ENUM') { | ||
if (prop.jsonSchema && prop.jsonSchema.enum) { | ||
prop.jsonSchema.enum.forEach(item => { | ||
enumList += `'${item}',`; | ||
}); | ||
// remove trailing comma | ||
enumList = enumList.substring(0, enumList.length - 1); | ||
} | ||
} | ||
// info on setting column specific properties | ||
@@ -773,2 +789,3 @@ // i.e dataLength, dataPrecision, dataScale | ||
if (colType) { | ||
if (colType === 'ENUM') return colType + '(' + enumList + ')'; | ||
if (colLength) return colType + '(' + colLength + ')'; | ||
@@ -775,0 +792,0 @@ if (colPrecision && colScale) return colType + '(' + colPrecision + ',' + colScale + ')'; |
{ | ||
"name": "loopback-connector-mysql", | ||
"version": "7.0.13", | ||
"version": "7.0.14", | ||
"description": "MySQL connector for loopback-datasource-juggler", | ||
@@ -24,6 +24,6 @@ "engines": { | ||
"dependencies": { | ||
"async": "^3.2.5", | ||
"debug": "^4.3.6", | ||
"async": "^3.2.6", | ||
"debug": "^4.3.7", | ||
"lodash": "^4.17.21", | ||
"loopback-connector": "^6.1.7", | ||
"loopback-connector": "^6.1.9", | ||
"mysql2": "^3.6.3", | ||
@@ -34,6 +34,6 @@ "patch-package": "^8.0.0", | ||
"devDependencies": { | ||
"@commitlint/config-conventional": "^19.2.2", | ||
"@commitlint/config-conventional": "^19.4.1", | ||
"eslint": "^8.57.0", | ||
"eslint-config-loopback": "^13.1.0", | ||
"loopback-datasource-juggler": "^5.0.12", | ||
"loopback-datasource-juggler": "^5.1.0", | ||
"mocha": "^10.7.3", | ||
@@ -40,0 +40,0 @@ "rc": "^1.2.8", |
108748
2231
Updatedasync@^3.2.6
Updateddebug@^4.3.7
Updatedloopback-connector@^6.1.9