Skip to content

Commit

Permalink
🐛 add custom enums or types when importing from postgresql
Browse files Browse the repository at this point in the history
no longer defaults to blob
  • Loading branch information
csc530 committed Oct 12, 2024
1 parent df54f86 commit 804a2a5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils/importSQL/postgres.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 804a2a5

Please sign in to comment.