diff --git a/lib/postgres.js b/lib/postgres.js index fbe2067..93420b9 100644 --- a/lib/postgres.js +++ b/lib/postgres.js @@ -868,21 +868,24 @@ function escape(val) { }; function datatype(p) { + var sizeStr = (p.size?'('+p.size+')':''); switch (p.type.name) { default: case 'String': case 'JSON': - return 'varchar'; + return 'varchar'+sizeStr; case 'Text': - return 'text'; + return 'text'+sizeStr; case 'Number': switch (p.dataType) { case 'double': case 'float': - return 'float'; + return 'float'+sizeStr; + case 'numeric': + return 'numeric'+sizeStr; case 'integer': default: - return 'integer'; + return 'integer'+sizeStr; } case 'Date': return 'timestamp with time zone';