From d3702ee4817857ff76ea017f55c9e806e4ab5c3c Mon Sep 17 00:00:00 2001 From: Pranay Pandey <79053599+Pranay-Pandey@users.noreply.github.com> Date: Wed, 8 Oct 2025 12:01:59 +0530 Subject: [PATCH] Add support for comments on tables and columns in PostgreSQL import (#625) --- src/utils/importSQL/postgres.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/utils/importSQL/postgres.js b/src/utils/importSQL/postgres.js index 2e74114..224a25d 100644 --- a/src/utils/importSQL/postgres.js +++ b/src/utils/importSQL/postgres.js @@ -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; + } + } + } } };