From fcf44031cba6e02acd602524ecc5b5c72d7d4b65 Mon Sep 17 00:00:00 2001 From: Alik Rakhmonov Date: Thu, 19 Dec 2024 13:04:07 +0100 Subject: [PATCH 1/3] HCK-9173: comment out inactive schema statement in script --- forward_engineering/ddlProvider.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/forward_engineering/ddlProvider.js b/forward_engineering/ddlProvider.js index 7ab9d6d..48a7c26 100644 --- a/forward_engineering/ddlProvider.js +++ b/forward_engineering/ddlProvider.js @@ -45,7 +45,7 @@ module.exports = (baseProvider, options, app) => { const terminator = getTerminator(options); return { - createSchema({ schemaName, databaseName, ifNotExist, comment }) { + createSchema({ schemaName, databaseName, ifNotExist, comment, isActivated }) { const schemaTerminator = ifNotExist ? ';' : terminator; const schemaComment = comment @@ -56,11 +56,14 @@ module.exports = (baseProvider, options, app) => { }) : ''; - let schemaStatement = assignTemplates(templates.createSchema, { - name: schemaName, - terminator: schemaTerminator, - comment: schemaComment ? `\n\n${schemaComment}` : '', - }); + let schemaStatement = commentIfDeactivated( + assignTemplates(templates.createSchema, { + name: schemaName, + terminator: schemaTerminator, + comment: schemaComment ? `\n\n${schemaComment}` : '', + }), + { isActivated }, + ); if (!databaseName) { return ifNotExist @@ -500,6 +503,7 @@ module.exports = (baseProvider, options, app) => { databaseName: containerData.databaseName, ifNotExist: containerData.ifNotExist, comment: containerData.role?.description ?? containerData.description, + isActivated: containerData.isActivated, }; }, From d82695e45647648918f9e985943efaa5e1312604 Mon Sep 17 00:00:00 2001 From: Alik Rakhmonov Date: Thu, 19 Dec 2024 16:35:40 +0100 Subject: [PATCH 2/3] fix: comment out if isActivated is not FALSE --- forward_engineering/helpers/commentIfDeactivated.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forward_engineering/helpers/commentIfDeactivated.js b/forward_engineering/helpers/commentIfDeactivated.js index 67bac10..5bf3821 100644 --- a/forward_engineering/helpers/commentIfDeactivated.js +++ b/forward_engineering/helpers/commentIfDeactivated.js @@ -2,7 +2,7 @@ const BEFORE_DEACTIVATED_STATEMENT = '-- '; const REG_FOR_MULTYLINE_COMMENT = /(\n\/\*\n[\s\S]*?\n\s\*\/\n)|((\n\/\*\n[\s\S]*?\n\s\*\/)$)/gi; const commentIfDeactivated = (statement, data, isPartOfLine) => { - if (data?.hasOwnProperty('isActivated') && !data.isActivated) { + if (data.isActivated === false) { if (isPartOfLine) { return '/* ' + statement + ' */'; } else if (statement.includes('\n')) { From f224a3b1497ed355926ee98824bdf6a4b5a50e2e Mon Sep 17 00:00:00 2001 From: Alik Rakhmonov Date: Thu, 19 Dec 2024 16:55:17 +0100 Subject: [PATCH 3/3] fix undefined --- forward_engineering/ddlProvider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forward_engineering/ddlProvider.js b/forward_engineering/ddlProvider.js index 48a7c26..f8fdc05 100644 --- a/forward_engineering/ddlProvider.js +++ b/forward_engineering/ddlProvider.js @@ -45,7 +45,7 @@ module.exports = (baseProvider, options, app) => { const terminator = getTerminator(options); return { - createSchema({ schemaName, databaseName, ifNotExist, comment, isActivated }) { + createSchema({ schemaName, databaseName, ifNotExist, comment, isActivated = true }) { const schemaTerminator = ifNotExist ? ';' : terminator; const schemaComment = comment