From 5727c629e985d775fb4d152c4438b80f187f1ac4 Mon Sep 17 00:00:00 2001 From: 1ilit <1ilit@proton.me> Date: Thu, 17 Apr 2025 18:04:55 +0400 Subject: [PATCH] Add table comment on import in mariadb and mysql (#411) --- src/utils/importSQL/mariadb.js | 7 +++++++ src/utils/importSQL/mysql.js | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/utils/importSQL/mariadb.js b/src/utils/importSQL/mariadb.js index bdc2836..6c0b775 100644 --- a/src/utils/importSQL/mariadb.js +++ b/src/utils/importSQL/mariadb.js @@ -161,6 +161,13 @@ export function fromMariaDB(ast, diagramDb = DB.GENERIC) { } } }); + + e.table_options.forEach((opt) => { + if (opt.keyword === "comment") { + table.comment = opt.value.replace(/^["']|["']$/g, ""); + } + }); + table.fields.forEach((f, j) => { f.id = j; }); diff --git a/src/utils/importSQL/mysql.js b/src/utils/importSQL/mysql.js index aac8fa0..3241bf8 100644 --- a/src/utils/importSQL/mysql.js +++ b/src/utils/importSQL/mysql.js @@ -161,6 +161,13 @@ export function fromMySQL(ast, diagramDb = DB.GENERIC) { } } }); + + e.table_options.forEach((opt) => { + if (opt.keyword === "comment") { + table.comment = opt.value.replace(/^["']|["']$/g, ''); + } + }); + table.fields.forEach((f, j) => { f.id = j; });