Fix dbml note quotes (#461)

This commit is contained in:
1ilit 2025-05-23 14:18:55 +04:00 committed by GitHub
parent 24712230a7
commit 2b8310910a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,6 @@
import { Cardinality } from "../../data/constants"; import { Cardinality } from "../../data/constants";
import i18n from "../../i18n/i18n"; import i18n from "../../i18n/i18n";
import { parseDefault } from "../exportSQL/shared"; import { escapeQuotes, parseDefault } from "../exportSQL/shared";
function columnDefault(field, database) { function columnDefault(field, database) {
if (!field.default || field.default.trim() === "") { if (!field.default || field.default.trim() === "") {
@ -15,7 +15,7 @@ function columnComment(field) {
return ""; return "";
} }
return `note: '${field.comment}'`; return `note: '${escapeQuotes(field.comment)}'`;
} }
function columnSettings(field, database) { function columnSettings(field, database) {
@ -99,7 +99,7 @@ export function toDBML(diagram) {
: "" : ""
}${ }${
table.comment && table.comment.trim() !== "" table.comment && table.comment.trim() !== ""
? `\n\n\tNote: '${table.comment}'` ? `\n\n\tNote: '${escapeQuotes(table.comment)}'`
: "" : ""
}\n}`, }\n}`,
) )