@minatojs/driver-mysql
Advanced tools
Comparing version 2.7.0 to 2.7.1
@@ -45,10 +45,10 @@ "use strict"; | ||
var DEFAULT_DATE = /* @__PURE__ */ new Date("1970-01-01"); | ||
function getIntegerType(length = 11) { | ||
if (length <= 4) | ||
function getIntegerType(length = 4) { | ||
if (length <= 1) | ||
return "tinyint"; | ||
if (length <= 6) | ||
if (length <= 2) | ||
return "smallint"; | ||
if (length <= 9) | ||
if (length <= 3) | ||
return "mediumint"; | ||
if (length <= 11) | ||
if (length <= 4) | ||
return "int"; | ||
@@ -70,5 +70,9 @@ return "bigint"; | ||
case "integer": | ||
if ((length || 0) > 8) | ||
logger.warn(`type ${type}(${length}) exceeds the max supported length`); | ||
return getIntegerType(length); | ||
case "primary": | ||
case "unsigned": | ||
if ((length || 0) > 8) | ||
logger.warn(`type ${type}(${length}) exceeds the max supported length`); | ||
return `${getIntegerType(length)} unsigned`; | ||
@@ -75,0 +79,0 @@ case "decimal": |
{ | ||
"name": "@minatojs/driver-mysql", | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"description": "MySQL Driver for Minato", | ||
@@ -29,3 +29,3 @@ "main": "lib/index.js", | ||
"peerDependencies": { | ||
"@minatojs/core": "^2.6.0" | ||
"@minatojs/core": "^2.6.1" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
@@ -18,7 +18,7 @@ import { createPool, format } from '@vlasky/mysql' | ||
function getIntegerType(length = 11) { | ||
if (length <= 4) return 'tinyint' | ||
if (length <= 6) return 'smallint' | ||
if (length <= 9) return 'mediumint' | ||
if (length <= 11) return 'int' | ||
function getIntegerType(length = 4) { | ||
if (length <= 1) return 'tinyint' | ||
if (length <= 2) return 'smallint' | ||
if (length <= 3) return 'mediumint' | ||
if (length <= 4) return 'int' | ||
return 'bigint' | ||
@@ -35,5 +35,9 @@ } | ||
case 'boolean': return 'bit' | ||
case 'integer': return getIntegerType(length) | ||
case 'integer': | ||
if ((length || 0) > 8) logger.warn(`type ${type}(${length}) exceeds the max supported length`) | ||
return getIntegerType(length) | ||
case 'primary': | ||
case 'unsigned': return `${getIntegerType(length)} unsigned` | ||
case 'unsigned': | ||
if ((length || 0) > 8) logger.warn(`type ${type}(${length}) exceeds the max supported length`) | ||
return `${getIntegerType(length)} unsigned` | ||
case 'decimal': return `decimal(${precision}, ${scale}) unsigned` | ||
@@ -40,0 +44,0 @@ case 'char': return `char(${length || 255})` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68463
1247