Skip to content

Free, simple, and intuitive online database diagram editor and SQL generator.

Add table comment on import in mariadb and mysql (#411)

1ilit5727c629e985
diff --git a/src/utils/importSQL/mariadb.js b/src/utils/importSQL/mariadb.js
index bdc28362..6c0b7757 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 aac8fa0a..3241bf80 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;
});