json-schema-table
Advanced tools
Comparing version 1.0.7 to 1.0.8
{ | ||
"name": "json-schema-table", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Creates and maintains a SQL table structure", | ||
@@ -34,3 +34,3 @@ "homepage": "", | ||
"mssql-cr-layer": "^2.0.0", | ||
"pg-cr-layer": "^2.0.0", | ||
"pg-cr-layer": "^2.0.2", | ||
"pretty-hrtime": "^1.0.2" | ||
@@ -37,0 +37,0 @@ }, |
@@ -25,2 +25,3 @@ /* eslint-disable max-len */ | ||
dialect.bigint = !!config.bigint; | ||
dialect.doubleFloats = !!config.doubleFloats; | ||
} | ||
@@ -106,3 +107,3 @@ return { | ||
'c.DATA_TYPE as data_type,c.CHARACTER_MAXIMUM_LENGTH as character_maximum_length,' + | ||
'c.NUMERIC_PRECISION as numeric_precisison,c.NUMERIC_SCALE as numerico_scale ' + | ||
'c.NUMERIC_PRECISION as numeric_precision,c.NUMERIC_SCALE as numerico_scale ' + | ||
'FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE as pk ' + | ||
@@ -492,2 +493,3 @@ 'INNER JOIN INFORMATION_SCHEMA.COLUMNS as c ON pk.COLUMN_NAME=c.COLUMN_NAME AND pk.TABLE_NAME=c.TABLE_NAME AND ' + | ||
var integerType = this.bigint ? 'BIGINT' : 'INTEGER'; | ||
var floatType = this.doubleFloats ? 'DOUBLE PRECISION' : 'REAL'; | ||
@@ -540,4 +542,6 @@ switch (property.type) { | ||
column = 'NUMERIC(' + property.maxLength + ',' + property.decimals + ')'; | ||
} else if (property.maxLength > 0) { | ||
column = integerType; | ||
} else { | ||
column = integerType; | ||
column = floatType; | ||
} | ||
@@ -578,2 +582,3 @@ break; | ||
case 'integer': | ||
case 'boolean': | ||
case 'text': | ||
@@ -583,2 +588,9 @@ case 'date': | ||
break; | ||
case 'bigint': | ||
property.type = 'integer'; | ||
break; | ||
case 'real': | ||
case 'double precision': | ||
property.type = 'number'; | ||
break; | ||
case 'time': | ||
@@ -585,0 +597,0 @@ property.type = 'time'; |
28470
702