fix(export): append semicolons to exported DDL statements
This commit is contained in:
1 parent
ba71068bc8
commit
aae2cae068
4 files changed
+47
-2
No files matched your search
@@ -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` : "";
|
||||
}
|
||||
Reference in new issue
Block a user