diff --git a/forward_engineering/ddlProvider.js b/forward_engineering/ddlProvider.js index deaa8d5..0b65a6e 100644 --- a/forward_engineering/ddlProvider.js +++ b/forward_engineering/ddlProvider.js @@ -53,6 +53,7 @@ module.exports = (baseProvider, options, app) => { functions, procedures, comment, + isActivated = true, }) { let database; const schemaComment = assignTemplates(templates.comment, { @@ -86,9 +87,10 @@ module.exports = (baseProvider, options, app) => { const userProcedures = procedures.map(procedure => assignTemplates(templates.createProcedure, setOrReplace(procedure)), ); - return [database, comment ? _.trimStart(schemaComment) : '', ...userFunctions, ...userProcedures] + const statement = [database, comment ? _.trimStart(schemaComment) : '', ...userFunctions, ...userProcedures] .filter(Boolean) .join('\n'); + return commentIfDeactivated(statement, { isActivated }); }, createTable(tableData, isActivated) { @@ -283,6 +285,7 @@ module.exports = (baseProvider, options, app) => { ? procedures.map(hydrateProcedure(containerData.name)).filter(filterProcedure) : [], comment: containerData.description, + isActivated: containerData.isActivated, }; }, diff --git a/forward_engineering/helpers/commentDeactivatedHelper.js b/forward_engineering/helpers/commentDeactivatedHelper.js index 52a84b8..253518c 100644 --- a/forward_engineering/helpers/commentDeactivatedHelper.js +++ b/forward_engineering/helpers/commentDeactivatedHelper.js @@ -1,7 +1,5 @@ -const _ = require('lodash'); - const commentIfDeactivated = (statement, data, isPartOfLine) => { - if (_.has(data, 'isActivated') && !data.isActivated) { + if (data.isActivated === false) { if (isPartOfLine) { return '/* ' + statement + ' */'; } else if (statement.includes('\n')) {