From 9414016609b79250a4e2ca232b52aba824b1a0cf Mon Sep 17 00:00:00 2001 From: Nazar Kovtun <88377450+WilhelmWesser@users.noreply.github.com> Date: Mon, 6 Mar 2023 09:23:03 +0200 Subject: [PATCH] =?UTF-8?q?HCK-3074:=20PostgreSQL:=20add=20db=20version=20?= =?UTF-8?q?check=20for=20security=5Finvoker=20to=20be=E2=80=A6=20(#43)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * HCK-3074: PostgreSQL: add db version check for security_invoker to be able to be included into ddl script * HCK-3074: PostgreSQL: remove tabs * HCK-3074: PostgreSQL plugin: edit security_invoker ternary operator formatting * HCK-3074: PostgreSQL plugin: edit formatting * HCK-3074: PostgreSQL plugin: edit redundant indents for security_invoker ternary --- forward_engineering/ddlProvider.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/forward_engineering/ddlProvider.js b/forward_engineering/ddlProvider.js index dd39185..9eec760 100644 --- a/forward_engineering/ddlProvider.js +++ b/forward_engineering/ddlProvider.js @@ -425,7 +425,7 @@ module.exports = (baseProvider, options, app) => { ? commentIfDeactivated(dividedColumns.deactivatedItems.join(',\n\t\t'), { isActivated: false, isPartOfLine: true, - }) + }) : ''; columnsAsString = dividedColumns.activatedItems.join(',\n\t\t') + deactivatedColumnsString; } @@ -435,13 +435,15 @@ module.exports = (baseProvider, options, app) => { : assignTemplates(templates.viewSelectStatement, { tableName: tables.join(', '), keys: columnsAsString, - }); + }); const check_option = viewData.viewOptions?.check_option ? `check_option=${viewData.viewOptions?.check_option}` : ''; const security_barrier = viewData.viewOptions?.security_barrier ? `security_barrier` : ''; - const security_invoker = viewData.viewOptions?.security_invoker ? 'security_invoker' : ''; + const dbVersionWhereSecurityInvokerAppeared = 15; + const security_invoker = viewData.viewOptions?.security_invoker && + getDbVersion(dbData.dbVersion) >= dbVersionWhereSecurityInvokerAppeared ? 'security_invoker' : ''; const withOptions = check_option || security_barrier || security_invoker ? `\n\tWITH (${_.compact([check_option, security_barrier, security_invoker]).join(',')})` @@ -673,4 +675,4 @@ module.exports = (baseProvider, options, app) => { return statement; }, }; -}; +}; \ No newline at end of file