Skip to content

Commit

Permalink
HCK-3074: PostgreSQL: add db version check for security_invoker to be… (
Browse files Browse the repository at this point in the history
#43)

* 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
  • Loading branch information
WilhelmWesser authored Mar 6, 2023
1 parent fdfc267 commit 9414016
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions forward_engineering/ddlProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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(',')})`
Expand Down Expand Up @@ -673,4 +675,4 @@ module.exports = (baseProvider, options, app) => {
return statement;
},
};
};
};

0 comments on commit 9414016

Please sign in to comment.