Skip to content

Commit f3d6219

Browse files
committed
allow for quoted enum/types to be correctly imported
used prettier for formatting as per contributing.md the type/enum check is case sensitive as there is no way I found to verify if the type was declared in quotes (case-sensitive) or without (to-lowercase by postgres)
1 parent 804a2a5 commit f3d6219

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils/importSQL/postgres.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) {
3838
if (d.resource === "column") {
3939
field.name = d.column.column.expr.value;
4040

41-
let type = types.find((t) => t.name === d.definition.dataType)?.name
42-
type ??= enums.find((t) => t.name === d.definition.dataType)?.name
41+
let type = types.find((t) => new RegExp(`^(${t.name}|"${t.name}")$`).test(d.definition.dataType))?.name;
42+
type ??= enums.find((t) => new RegExp(`^(${t.name}|"${t.name}")$`).test(d.definition.dataType))?.name;
4343
if (!type && !dbToTypes[diagramDb][type])
4444
type = affinity[diagramDb][type];
4545
field.type = type || d.definition.dataType;

0 commit comments

Comments
 (0)