mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-10-13 22:10:49 +00:00
Add support for comments on tables and columns in PostgreSQL import (#625)
This commit is contained in:
@@ -360,6 +360,23 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else if (e.type === "comment") {
|
||||||
|
if (e.target.type === "table") {
|
||||||
|
const table = tables.find((t) => t.name === e.target?.name?.table);
|
||||||
|
if (table) {
|
||||||
|
table.comment = e.expr.expr.value;
|
||||||
|
}
|
||||||
|
} else if (e.target.type === "column") {
|
||||||
|
const table = tables.find((t) => t.name === e.target?.name?.table);
|
||||||
|
if (table) {
|
||||||
|
const field = table.fields.find(
|
||||||
|
(f) => f.name === e.target?.name?.column?.expr?.value,
|
||||||
|
);
|
||||||
|
if (field) {
|
||||||
|
field.comment = e.expr.expr.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user