From faec50af57221b76a5c18d710c194f09e24a3bff Mon Sep 17 00:00:00 2001 From: Daria Vorontsova Date: Tue, 2 Dec 2025 22:38:13 +0300 Subject: [PATCH] fix: align templates and remove extra indentation --- .../Tenant/utils/schemaQueryTemplates.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/containers/Tenant/utils/schemaQueryTemplates.ts b/src/containers/Tenant/utils/schemaQueryTemplates.ts index 521d28027d..fb2c1a5d6b 100644 --- a/src/containers/Tenant/utils/schemaQueryTemplates.ts +++ b/src/containers/Tenant/utils/schemaQueryTemplates.ts @@ -24,10 +24,6 @@ function toLF(str: string) { return str.replace(/\r\n?/g, '\n'); } -function indentBlock(str: string, pad = ' ') { - return str.replace(/^/gm, pad); -} - export const createTableTemplate = (params?: SchemaQueryParams) => { const tableName = params?.relativePath ? `\`${normalizeParameter(params.relativePath)}/my_row_table\`` @@ -333,8 +329,10 @@ export const createStreamingQueryTemplate = (params?: SchemaQueryParams) => { RUN = TRUE -- Run the query after creation ) AS DO BEGIN - INSERT INTO \${2:}.\${3:} - SELECT * FROM \${2:}.\${4:}; + +INSERT INTO \${2:}.\${3:} +SELECT * FROM \${2:}.\${4:}; + END DO;`; }; @@ -360,14 +358,14 @@ export const alterStreamingQueryText = (params?: SchemaQueryParams) => { queryText = stripIndentByFirstLine(queryText); queryText = normalizeParameter(queryText); - const bodyQueryText = queryText - ? indentBlock(queryText) - : indentBlock('${2:}'); + const bodyQueryText = queryText ? queryText : '${2:}'; return `ALTER STREAMING QUERY ${streamingQueryName} SET ( FORCE = TRUE, -- Allow to drop last query checkpoint if query state can't be loaded ) AS DO BEGIN + ${bodyQueryText} + END DO;`; };