Fix multiline dbml comment export (#550)

This commit is contained in:
1ilit
2025-08-09 15:01:31 +04:00
committed by GitHub
parent b62471c03f
commit 6ade511bbd

View File

@@ -74,6 +74,14 @@ function fieldSize(field, database) {
return ""; return "";
} }
function processComment(comment) {
if (comment.includes("\n")) {
return `'''${comment}'''`;
}
return `'${escapeQuotes(comment)}'`;
}
export function toDBML(diagram) { export function toDBML(diagram) {
const generateRelString = (rel) => { const generateRelString = (rel) => {
const { fields: startTableFields, name: startTableName } = const { fields: startTableFields, name: startTableName } =
@@ -139,7 +147,7 @@ export function toDBML(diagram) {
: "" : ""
}${ }${
table.comment && table.comment.trim() !== "" table.comment && table.comment.trim() !== ""
? `\n\n\tNote: '${escapeQuotes(table.comment)}'` ? `\n\n\tNote: ${processComment(table.comment)}`
: "" : ""
}\n}`, }\n}`,
) )