Remove unnecessary commas in export index statements

This commit is contained in:
1ilit
2024-07-08 04:19:14 +03:00
parent 159dcca4dc
commit 6fee6553f1
5 changed files with 82 additions and 108 deletions

View File

@@ -32,18 +32,16 @@ export function toMySQL(diagram) {
.map((f) => `\`${f.name}\``)
.join(", ")})`
: ""
}\n)${table.comment ? ` COMMENT='${table.comment}'` : ""};\n${
table.indices.length > 0
? `\n${table.indices.map(
(i) =>
`\nCREATE ${i.unique ? "UNIQUE " : ""}INDEX \`${
i.name
}\`\nON \`${table.name}\` (${i.fields
.map((f) => `\`${f}\``)
.join(", ")});`,
)}`
: ""
}`,
}\n)${table.comment ? ` COMMENT='${table.comment}'` : ""};\n${`\n${table.indices
.map(
(i) =>
`\nCREATE ${i.unique ? "UNIQUE " : ""}INDEX \`${
i.name
}\`\nON \`${table.name}\` (${i.fields
.map((f) => `\`${f}\``)
.join(", ")});`,
)
.join("")}`}`,
)
.join("\n")}\n${diagram.references
.map(