mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-05-24 02:09:17 +00:00
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)
This commit is contained in:
parent
804a2a5387
commit
965d1bb145
@ -38,8 +38,16 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) {
|
||||
if (d.resource === "column") {
|
||||
field.name = d.column.column.expr.value;
|
||||
|
||||
let type = types.find((t) => t.name === d.definition.dataType)?.name
|
||||
type ??= enums.find((t) => t.name === d.definition.dataType)?.name
|
||||
let type = types.find((t) =>
|
||||
new RegExp(`^(${t.name}|"${t.name}")$`).test(
|
||||
d.definition.dataType,
|
||||
),
|
||||
)?.name;
|
||||
type ??= enums.find((t) =>
|
||||
new RegExp(`^(${t.name}|"${t.name}")$`).test(
|
||||
d.definition.dataType,
|
||||
),
|
||||
)?.name;
|
||||
if (!type && !dbToTypes[diagramDb][type])
|
||||
type = affinity[diagramDb][type];
|
||||
field.type = type || d.definition.dataType;
|
||||
|
Loading…
Reference in New Issue
Block a user