fix(export): append semicolons to exported DDL statements

This commit is contained in:
onenewcode
2026-06-30 18:00:44 +08:00
committed by GitHub
parent ba71068bc8
commit aae2cae068
4 changed files with 47 additions and 2 deletions
+15
View File
@@ -0,0 +1,15 @@
export function ensureSqlStatementTerminator(sql: string): string {
const trimmed = sql.trim();
if (!trimmed) return "";
return trimmed.endsWith(";") ? trimmed : `${trimmed};`;
}
export function buildSingleDdlExportFileContent(sql: string): string {
const statement = ensureSqlStatementTerminator(sql);
return statement ? `${statement}\n` : "";
}
export function joinExportedDdls(ddls: readonly string[]): string {
const statements = ddls.map(ensureSqlStatementTerminator).filter(Boolean);
return statements.length ? `${statements.join("\n\n")}\n` : "";
}