mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-08-29 02:25:26 +00:00
Fix multiline dbml comment export (#550)
This commit is contained in:
@@ -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}`,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user