From f2c0ab5d2cd4b60a1091604dd7fd0e0198ce2719 Mon Sep 17 00:00:00 2001 From: Pranay Pandey Date: Tue, 7 Oct 2025 21:51:50 +0530 Subject: [PATCH] Add support for comments on tables and columns in PostgreSQL import --- 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 2e741145e..224a25d2e 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; + } + } + } } };