From e861565ca9f9dd0f2e2e68395a24d8477c6018f9 Mon Sep 17 00:00:00 2001 From: yevhenii-moroziuk Date: Thu, 31 Oct 2024 16:21:07 +0200 Subject: [PATCH] HCK-8608: Oracle. Invalid COMMENT ON statements for Mat. Views in DDL Script tab --- forward_engineering/ddlProvider/ddlProvider.js | 8 +++++++- forward_engineering/utils/general.js | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/forward_engineering/ddlProvider/ddlProvider.js b/forward_engineering/ddlProvider/ddlProvider.js index 55886e4..9230563 100644 --- a/forward_engineering/ddlProvider/ddlProvider.js +++ b/forward_engineering/ddlProvider/ddlProvider.js @@ -614,6 +614,12 @@ module.exports = (baseProvider, options, app) => { ); }, + constructViewObjectForComment({ viewData }) { + const object = 'VIEW'; + + return viewData.materialized ? 'MATERIALIZED ' + object : object; + }, + createView(viewData, dbData, isActivated) { const viewName = getNamePrefixedWithSchemaName(viewData.name, viewData.schemaName); @@ -623,7 +629,7 @@ module.exports = (baseProvider, options, app) => { const comment = viewData.description ? '\n' + assignTemplates(templates.comment, { - object: 'TABLE', + object: this.constructViewObjectForComment({ viewData }), objectName: viewName, comment: wrapComment(viewData.description), }) + diff --git a/forward_engineering/utils/general.js b/forward_engineering/utils/general.js index fa3c2c4..95ee07a 100644 --- a/forward_engineering/utils/general.js +++ b/forward_engineering/utils/general.js @@ -123,9 +123,9 @@ module.exports = _ => { return '/* ' + statement + ' */'; } else if (statement.includes('\n')) { return '/*\n' + statement + ' */\n'; - } else { - return inlineComment + ' ' + statement; } + + return inlineComment + ' ' + statement; }; const wrap = (str, start = "'", end = "'") => { @@ -134,9 +134,9 @@ module.exports = _ => { if (lastChar === start && firstChar === end) { return str; - } else { - return `${start}${str}${end}`; } + + return `${start}${str}${end}`; }; const wrapInQuotes = name => `"${name}"`;