Export with size bug fixed

This commit is contained in:
Kartik Buttan 2024-07-27 00:51:26 +05:30
parent 95366776e8
commit 7db4cc76a5

View File

@ -2,6 +2,8 @@ import { dbToTypes } from "../../data/datatypes";
import { parseDefault } from "./shared";
export function toMySQL(diagram) {
console.log(diagram);
// console.log(mysqlTypes[field.type.toString()]);
return `${diagram.tables
.map(
(table) =>
@ -12,7 +14,9 @@ export function toMySQL(diagram) {
(field) =>
`${field.comment === "" ? "" : `\t-- ${field.comment}\n`}\t\`${
field.name
}\` ${field.type}${field.notNull ? " NOT NULL" : ""}${
}\` ${field.type}${(field.size !== undefined && field.size !== "")? "(" + field.size + ")" : ""}${
field.notNull ? " NOT NULL" : ""
}${
field.increment ? " AUTO_INCREMENT" : ""
}${field.unique ? " UNIQUE" : ""}${
field.default !== ""