Skip to content

Commit 7db4cc7

Browse files
committed
Export with size bug fixed
1 parent 9536677 commit 7db4cc7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/utils/exportSQL/mysql.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { dbToTypes } from "../../data/datatypes";
22
import { parseDefault } from "./shared";
33

44
export function toMySQL(diagram) {
5+
console.log(diagram);
6+
// console.log(mysqlTypes[field.type.toString()]);
57
return `${diagram.tables
68
.map(
79
(table) =>
@@ -12,7 +14,9 @@ export function toMySQL(diagram) {
1214
(field) =>
1315
`${field.comment === "" ? "" : `\t-- ${field.comment}\n`}\t\`${
1416
field.name
15-
}\` ${field.type}${field.notNull ? " NOT NULL" : ""}${
17+
}\` ${field.type}${(field.size !== undefined && field.size !== "")? "(" + field.size + ")" : ""}${
18+
field.notNull ? " NOT NULL" : ""
19+
}${
1620
field.increment ? " AUTO_INCREMENT" : ""
1721
}${field.unique ? " UNIQUE" : ""}${
1822
field.default !== ""

0 commit comments

Comments
 (0)