Include comment statements when exporting MySQL SQL script

This commit is contained in:
MagMongoing 2024-04-24 15:13:46 +08:00
parent 3a580149be
commit 3bf5eadc70

View File

@ -181,7 +181,7 @@ export function jsonToMySQL(obj) {
)}", \`${field.name}\`))` )}", \`${field.name}\`))`
: "" : ""
: ` CHECK(${field.check})` : ` CHECK(${field.check})`
}`, }${field.comment ? ` COMMENT '${field.comment}'` : ''}`,
) )
.join(",\n")}${ .join(",\n")}${
table.fields.filter((f) => f.primary).length > 0 table.fields.filter((f) => f.primary).length > 0
@ -190,7 +190,7 @@ export function jsonToMySQL(obj) {
.map((f) => `\`${f.name}\``) .map((f) => `\`${f.name}\``)
.join(", ")})` .join(", ")})`
: "" : ""
}\n);\n${ }\n)${table.comment ? ` COMMENT='${table.comment}'` : ''};\n${
table.indices.length > 0 table.indices.length > 0
? `\n${table.indices.map( ? `\n${table.indices.map(
(i) => (i) =>