Skip to content

Commit

Permalink
HCK-9173: comment out inactive schema statement in script (#36)
Browse files Browse the repository at this point in the history
* HCK-9173: comment out inactive schema statement in script

* fix if isActivated undefined
  • Loading branch information
AlikRakhmonov authored Dec 19, 2024
1 parent 9add89f commit 96f432c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions forward_engineering/ddlProvider/ddlProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ module.exports = (baseProvider, options, app) => {
});
},

createSchema({ schemaName, ifNotExist, comments, udfs, procedures }) {
createSchema({ schemaName, ifNotExist, comments, udfs, procedures, isActivated = true }) {
const comment = assignTemplates(templates.comment, {
object: 'SCHEMA',
objectName: wrapInQuotes(schemaName),
Expand All @@ -121,12 +121,13 @@ module.exports = (baseProvider, options, app) => {
const createFunctionStatement = getFunctionsScript(schemaName, udfs);
const createProceduresStatement = getProceduresScript(schemaName, procedures);

return _.chain([schemaStatement, createFunctionStatement, createProceduresStatement])
const statement = _.chain([schemaStatement, createFunctionStatement, createProceduresStatement])
.compact()
.map(_.trim)
.join('\n\n')
.trim()
.value();
return commentIfDeactivated(statement, { isActivated });
},

createTable(
Expand Down Expand Up @@ -678,6 +679,7 @@ module.exports = (baseProvider, options, app) => {
udfs: data?.udfs || [],
procedures: data?.procedures || [],
dbVersion,
isActivated: containerData.isActivated ?? true,
};
},

Expand Down

0 comments on commit 96f432c

Please sign in to comment.