mirror of
https://github.com/chartdb/chartdb.git
synced 2025-11-05 22:43:30 +00:00
fix(sql-export): escape newlines and quotes in multi-line comments (#765)
This commit is contained in:
@@ -285,13 +285,13 @@ export const exportBaseSQL = ({
|
||||
|
||||
// Add table comment
|
||||
if (table.comments) {
|
||||
sqlScript += `COMMENT ON TABLE ${tableName} IS '${table.comments}';\n`;
|
||||
sqlScript += `COMMENT ON TABLE ${tableName} IS '${table.comments.replace(/'/g, "''")}';\n`;
|
||||
}
|
||||
|
||||
table.fields.forEach((field) => {
|
||||
// Add column comment
|
||||
if (field.comments) {
|
||||
sqlScript += `COMMENT ON COLUMN ${tableName}.${field.name} IS '${field.comments}';\n`;
|
||||
sqlScript += `COMMENT ON COLUMN ${tableName}.${field.name} IS '${field.comments.replace(/'/g, "''")}';\n`;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user