From 6ade511bbd2fbfdd797ac81b9bf17d7cf100d579 Mon Sep 17 00:00:00 2001 From: 1ilit <1ilit@proton.me> Date: Sat, 9 Aug 2025 15:01:31 +0400 Subject: [PATCH] Fix multiline dbml comment export (#550) --- src/utils/exportAs/dbml.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/utils/exportAs/dbml.js b/src/utils/exportAs/dbml.js index 60b070e..0ee0933 100644 --- a/src/utils/exportAs/dbml.js +++ b/src/utils/exportAs/dbml.js @@ -74,6 +74,14 @@ function fieldSize(field, database) { return ""; } +function processComment(comment) { + if (comment.includes("\n")) { + return `'''${comment}'''`; + } + + return `'${escapeQuotes(comment)}'`; +} + export function toDBML(diagram) { const generateRelString = (rel) => { const { fields: startTableFields, name: startTableName } = @@ -139,7 +147,7 @@ export function toDBML(diagram) { : "" }${ table.comment && table.comment.trim() !== "" - ? `\n\n\tNote: '${escapeQuotes(table.comment)}'` + ? `\n\n\tNote: ${processComment(table.comment)}` : "" }\n}`, )