diff --git a/config.js b/config.js index 99be5d7..dc6b3b8 100644 --- a/config.js +++ b/config.js @@ -11,9 +11,13 @@ module.exports = { 'numeric': 'DECIMAL', 'varchar': 'VARCHAR', 'timestamp': 'TIMESTAMP', + 'timestamptz': 'TIMESTAMP', // PostgreSQL timestamp with time zone 'bool': 'BIT', 'text': 'TEXT', - 'bytea': 'BLOB' + 'bytea': 'BLOB', + 'float8': 'DOUBLE', // PostgreSQL double precision + 'float4': 'REAL', // PostgreSQL real/float + 'float': 'REAL' // 通用float }, // 序列DEFAULT值转换规则 diff --git a/converter.js b/converter.js index a66a345..817ede2 100644 --- a/converter.js +++ b/converter.js @@ -43,8 +43,8 @@ class PG2DMConverter { convertDataTypes(sql) { let converted = sql; - // 1. 转换基本类型 - const typePattern = /\b(int8|int4|int2|numeric|bool)\b/gi; + // 1. 转换基本类型(包括浮点类型和时间戳类型) + const typePattern = /\b(int8|int4|int2|numeric|bool|float8|float4|float|timestamptz)\b/gi; converted = converted.replace(typePattern, (match) => { const lowerMatch = match.toLowerCase();