diff --git a/src/utils/importSQL/postgres.js b/src/utils/importSQL/postgres.js index 2912404..13f5171 100644 --- a/src/utils/importSQL/postgres.js +++ b/src/utils/importSQL/postgres.js @@ -38,11 +38,11 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) { if (d.resource === "column") { field.name = d.column.column.expr.value; - let type = d.definition.dataType; - if (!dbToTypes[diagramDb][type]) { + let type = types.find((t) => t.name === d.definition.dataType)?.name + type ??= enums.find((t) => t.name === d.definition.dataType)?.name + if (!type && !dbToTypes[diagramDb][type]) type = affinity[diagramDb][type]; - } - field.type = type; + field.type = type || d.definition.dataType; if (d.definition.expr && d.definition.expr.type === "expr_list") { field.values = d.definition.expr.value.map((v) => v.value);