diff --git a/forward_engineering/ddlProvider.js b/forward_engineering/ddlProvider.js index 078805b..11ee45c 100644 --- a/forward_engineering/ddlProvider.js +++ b/forward_engineering/ddlProvider.js @@ -35,7 +35,7 @@ module.exports = (baseProvider, options, app) => { const { generateConstraint } = require('./helpers/constraintHelper')(app); return { - createDatabase({ + createSchema({ name, authorization, quota, @@ -252,7 +252,7 @@ module.exports = (baseProvider, options, app) => { return { statement: columnStatement, isActivated: columnDefinition.isActivated }; }, - hydrateDatabase(containerData, { udfs, procedures } = {}) { + hydrateSchema(containerData, { udfs, procedures } = {}) { return { name: containerData.name, authorization: containerData.authorizationUsername @@ -291,6 +291,11 @@ module.exports = (baseProvider, options, app) => { }; }, + // Keep it because it was used to hydrate `dbData` for the API + hydrateDatabase(containerData, data) { + return this.hydrateSchema(containerData, data); + }, + hydrateTable({ tableData, entityData, jsonSchema }) { const firstTab = _.get(entityData, '[0]', {}); const secondTab = _.get(entityData, '[1]', {}); @@ -411,6 +416,14 @@ module.exports = (baseProvider, options, app) => { return commentIfDeactivated(statement, data, isPartOfLine); }, + commentStatement(statement) { + return commentIfDeactivated(statement, { isActivated: false }); + }, + + prepareName(name) { + return `"${name}"`; + }, + // * statements for alter script from delta model dropSchema(schemaName) { return assignTemplates(templates.dropSchema, { name: schemaName }); diff --git a/forward_engineering/helpers/alterScriptHelpers/alterContainerHelper.js b/forward_engineering/helpers/alterScriptHelpers/alterContainerHelper.js index c083555..fee23eb 100644 --- a/forward_engineering/helpers/alterScriptHelpers/alterContainerHelper.js +++ b/forward_engineering/helpers/alterScriptHelpers/alterContainerHelper.js @@ -8,12 +8,12 @@ module.exports = app => { const getAddContainerScript = containerData => { const constructedDbData = getDbData([containerData]); - const schemaData = ddlProvider.hydrateDatabase(constructedDbData, { + const schemaData = ddlProvider.hydrateSchema(constructedDbData, { udfs: containerData.role?.UDFs, procedures: containerData.role?.Procedures, }); - return _.trim(ddlProvider.createDatabase(schemaData)); + return _.trim(ddlProvider.createSchema(schemaData)); }; const getDeleteContainerScript = containerData => { @@ -28,7 +28,7 @@ module.exports = app => { containerData.compMod.quota?.old !== containerData.compMod.quota?.new; const constructedDbData = getDbData([containerData]); - const schemaData = ddlProvider.hydrateDatabase(constructedDbData, { + const schemaData = ddlProvider.hydrateSchema(constructedDbData, { udfs: containerData.role?.UDFs, procedures: containerData.role?.Procedures, }); diff --git a/localization/en.json b/localization/en.json index 97fe04a..6ba0f34 100644 --- a/localization/en.json +++ b/localization/en.json @@ -170,5 +170,10 @@ "MODAL_WINDOW___OPTIONS_DISPLAY_ERD_V_ENTITY_BOX_CONTENT": "Display of table box content", "MODAL_WINDOW___OPTIONS_DISPLAY_ERD_V_FIELDS": "Columns", "MODAL_WINDOW___OPTIONS_DISPLAY_REQUIRED_ATTRIBUTES": "Required columns", - "MODAL_WINDOW___OPTIONS_DISPLAY_NULLABLE_ATTRIBUTES": "Nullable columns" + "MODAL_WINDOW___OPTIONS_DISPLAY_NULLABLE_ATTRIBUTES": "Nullable columns", + + "CUSTOM_SCRIPT_CONTAINER_VAR_NAME": "Schema name", + "CUSTOM_SCRIPT_CONTAINER_VAR": "schemaName", + "CUSTOM_SCRIPT_ENTITY_VAR_NAME": "Table name", + "CUSTOM_SCRIPT_ENTITY_VAR": "tableName" } diff --git a/properties_pane/container_level/containerLevelConfig.json b/properties_pane/container_level/containerLevelConfig.json index 8415190..2606207 100644 --- a/properties_pane/container_level/containerLevelConfig.json +++ b/properties_pane/container_level/containerLevelConfig.json @@ -2,9 +2,9 @@ * Copyright © 2016-2019 by IntegrIT S.A. dba Hackolade. All rights reserved. * * The copyright to the computer software herein is the property of IntegrIT S.A. -* The software may be used and/or copied only with the written permission of -* IntegrIT S.A. or in accordance with the terms and conditions stipulated in -* the agreement/contract under which the software has been supplied. +* The software may be used and/or copied only with the written permission of +* IntegrIT S.A. or in accordance with the terms and conditions stipulated in +* the agreement/contract under which the software has been supplied. In order to define custom properties for any object's properties pane, you may copy/paste from the following, @@ -71,8 +71,8 @@ making sure that you maintain a proper JSON format. ] }, // “groupInput” can have the following states - 0 items, 1 item, and many items. -// “blockInput” has only 2 states - 0 items or 1 item. -// This gives us an easy way to represent it as an object and not as an array internally which is beneficial for processing +// “blockInput” has only 2 states - 0 items or 1 item. +// This gives us an easy way to represent it as an object and not as an array internally which is beneficial for processing // and forward-engineering in particular. { "propertyName": "Block", @@ -100,7 +100,7 @@ making sure that you maintain a proper JSON format. "propertyKeyword": "keyList", "propertyType": "fieldList", "template": "orderedList" - }, + }, { "propertyName": "List with attribute", "propertyKeyword": "keyListOrder", @@ -440,6 +440,128 @@ making sure that you maintain a proper JSON format. "value": true } }, + { + "propertyName": "Custom scripts", + "propertyType": "block", + "propertyKeyword": "customScripts", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Before CREATE SCHEMA", + "propertyKeyword": "beforeCreateContainer", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "After CREATE SCHEMA", + "propertyKeyword": "afterCreateContainer", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "Before each CREATE TABLE", + "propertyKeyword": "beforeCreateEntity", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "After each CREATE TABLE", + "propertyKeyword": "afterCreateEntity", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "Before each CREATE VIEW", + "propertyKeyword": "beforeCreateView", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "After each CREATE VIEW", + "propertyKeyword": "afterCreateView", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + } + ] + }, { "propertyName": "Remarks", "propertyKeyword": "comments", diff --git a/properties_pane/entity_level/entityLevelConfig.json b/properties_pane/entity_level/entityLevelConfig.json index 2028f3e..2cb7a4c 100644 --- a/properties_pane/entity_level/entityLevelConfig.json +++ b/properties_pane/entity_level/entityLevelConfig.json @@ -2,9 +2,9 @@ * Copyright © 2016-2019 by IntegrIT S.A. dba Hackolade. All rights reserved. * * The copyright to the computer software herein is the property of IntegrIT S.A. -* The software may be used and/or copied only with the written permission of -* IntegrIT S.A. or in accordance with the terms and conditions stipulated in -* the agreement/contract under which the software has been supplied. +* The software may be used and/or copied only with the written permission of +* IntegrIT S.A. or in accordance with the terms and conditions stipulated in +* the agreement/contract under which the software has been supplied. In order to define custom properties for any object's properties pane, you may copy/paste from the following, making sure that you maintain a proper JSON format. @@ -70,8 +70,8 @@ making sure that you maintain a proper JSON format. ] }, // “groupInput” can have the following states - 0 items, 1 item, and many items. -// “blockInput” has only 2 states - 0 items or 1 item. -// This gives us an easy way to represent it as an object and not as an array internally which is beneficial for processing +// “blockInput” has only 2 states - 0 items or 1 item. +// This gives us an easy way to represent it as an object and not as an array internally which is beneficial for processing // and forward-engineering in particular. { "propertyName": "Block", @@ -99,7 +99,7 @@ making sure that you maintain a proper JSON format. "propertyKeyword": "keyList", "propertyType": "fieldList", "template": "orderedList" - }, + }, { "propertyName": "List with attribute", "propertyKeyword": "keyListOrder", @@ -268,6 +268,52 @@ making sure that you maintain a proper JSON format. "template": "textarea", "markdown": false }, + { + "propertyName": "Custom scripts", + "propertyType": "block", + "propertyKeyword": "customScripts", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Before CREATE TABLE", + "propertyKeyword": "beforeCreateEntity", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "After CREATE TABLE", + "propertyKeyword": "afterCreateEntity", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + } + ] + }, { "propertyName": "Remarks", "propertyKeyword": "comments", diff --git a/properties_pane/model_level/modelLevelConfig.json b/properties_pane/model_level/modelLevelConfig.json index 31eeff9..ec5edb4 100644 --- a/properties_pane/model_level/modelLevelConfig.json +++ b/properties_pane/model_level/modelLevelConfig.json @@ -2,9 +2,9 @@ * Copyright © 2016-2019 by IntegrIT S.A. dba Hackolade. All rights reserved. * * The copyright to the computer software herein is the property of IntegrIT S.A. -* The software may be used and/or copied only with the written permission of -* IntegrIT S.A. or in accordance with the terms and conditions stipulated in -* the agreement/contract under which the software has been supplied. +* The software may be used and/or copied only with the written permission of +* IntegrIT S.A. or in accordance with the terms and conditions stipulated in +* the agreement/contract under which the software has been supplied. In order to define custom properties for any object's properties pane, you may copy/paste from the following, making sure that you maintain a proper JSON format. @@ -70,8 +70,8 @@ making sure that you maintain a proper JSON format. ] }, // “groupInput” can have the following states - 0 items, 1 item, and many items. -// “blockInput” has only 2 states - 0 items or 1 item. -// This gives us an easy way to represent it as an object and not as an array internally which is beneficial for processing +// “blockInput” has only 2 states - 0 items or 1 item. +// This gives us an easy way to represent it as an object and not as an array internally which is beneficial for processing // and forward-engineering in particular. { "propertyName": "Block", @@ -99,7 +99,7 @@ making sure that you maintain a proper JSON format. "propertyKeyword": "keyList", "propertyType": "fieldList", "template": "orderedList" - }, + }, { "propertyName": "List with attribute", "propertyKeyword": "keyListOrder", @@ -256,6 +256,166 @@ making sure that you maintain a proper JSON format. } ] }, + { + "propertyName": "Custom scripts", + "propertyType": "block", + "propertyKeyword": "customScripts", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Header script", + "propertyKeyword": "headerScript", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "Footer script", + "propertyKeyword": "footerScript", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "Before each CREATE SCHEMA", + "propertyKeyword": "beforeCreateContainer", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "After each CREATE SCHEMA", + "propertyKeyword": "afterCreateContainer", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "Before each CREATE TABLE", + "propertyKeyword": "beforeCreateEntity", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "After each CREATE TABLE", + "propertyKeyword": "afterCreateEntity", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "Before each CREATE VIEW", + "propertyKeyword": "beforeCreateView", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "After each CREATE VIEW", + "propertyKeyword": "afterCreateView", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + } + ] + }, { "propertyName": "Comments", "propertyKeyword": "comments", diff --git a/properties_pane/view_level/viewLevelConfig.json b/properties_pane/view_level/viewLevelConfig.json index 801f644..008c5c1 100644 --- a/properties_pane/view_level/viewLevelConfig.json +++ b/properties_pane/view_level/viewLevelConfig.json @@ -143,6 +143,52 @@ "shouldValidate": false, "propertyType": "checkbox" }, + { + "propertyName": "Custom scripts", + "propertyType": "block", + "propertyKeyword": "customScripts", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Before CREATE VIEW", + "propertyKeyword": "beforeCreateView", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "After CREATE VIEW", + "propertyKeyword": "afterCreateView", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + } + ] + }, { "propertyName": "Remarks", "propertyKeyword": "comments",