mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-05-24 10:29:11 +00:00
🐛 add custom enums or types when importing from postgresql
no longer defaults to blob
This commit is contained in:
parent
df54f864da
commit
804a2a5387
@ -38,11 +38,11 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) {
|
|||||||
if (d.resource === "column") {
|
if (d.resource === "column") {
|
||||||
field.name = d.column.column.expr.value;
|
field.name = d.column.column.expr.value;
|
||||||
|
|
||||||
let type = d.definition.dataType;
|
let type = types.find((t) => t.name === d.definition.dataType)?.name
|
||||||
if (!dbToTypes[diagramDb][type]) {
|
type ??= enums.find((t) => t.name === d.definition.dataType)?.name
|
||||||
|
if (!type && !dbToTypes[diagramDb][type])
|
||||||
type = affinity[diagramDb][type];
|
type = affinity[diagramDb][type];
|
||||||
}
|
field.type = type || d.definition.dataType;
|
||||||
field.type = type;
|
|
||||||
|
|
||||||
if (d.definition.expr && d.definition.expr.type === "expr_list") {
|
if (d.definition.expr && d.definition.expr.type === "expr_list") {
|
||||||
field.values = d.definition.expr.value.map((v) => v.value);
|
field.values = d.definition.expr.value.map((v) => v.value);
|
||||||
|
Loading…
Reference in New Issue
Block a user