Skip to content

Commit ab9213c

Browse files
1ilitewqazxc
authored andcommitted
Add table comment on import in mariadb and mysql (drawdb-io#411)
1 parent eb37014 commit ab9213c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/utils/importSQL/mariadb.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ export function fromMariaDB(ast, diagramDb = DB.GENERIC) {
161161
}
162162
}
163163
});
164+
165+
e.table_options.forEach((opt) => {
166+
if (opt.keyword === "comment") {
167+
table.comment = opt.value.replace(/^["']|["']$/g, "");
168+
}
169+
});
170+
164171
table.fields.forEach((f, j) => {
165172
f.id = j;
166173
});

src/utils/importSQL/mysql.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ export function fromMySQL(ast, diagramDb = DB.GENERIC) {
161161
}
162162
}
163163
});
164+
165+
e.table_options.forEach((opt) => {
166+
if (opt.keyword === "comment") {
167+
table.comment = opt.value.replace(/^["']|["']$/g, '');
168+
}
169+
});
170+
164171
table.fields.forEach((f, j) => {
165172
f.id = j;
166173
});

0 commit comments

Comments
 (0)