diff --git a/forward_engineering/ddlProvider.js b/forward_engineering/ddlProvider.js index 12c3e80..486fc34 100644 --- a/forward_engineering/ddlProvider.js +++ b/forward_engineering/ddlProvider.js @@ -56,7 +56,7 @@ module.exports = (baseProvider, options, app) => { const additionalOptions = getAdditionalOptions(options.additionalOptions); return dropStatementProxy({ commentIfDeactivated })(additionalOptions.applyDropStatements, { - hydrateDatabase(containerData) { + hydrateSchema(containerData) { return { databaseName: containerData.name, isActivated: containerData.isActivated, @@ -72,6 +72,11 @@ module.exports = (baseProvider, options, app) => { }; }, + // Keep it because it was used to hydrate `dbData` for the API + hydrateDatabase(containerData) { + return this.hydrateSchema(containerData); + }, + hydrateTable({ tableData, entityData, jsonSchema }) { const detailsTab = entityData[0]; const tableIndexes = entityData[2].Indxs; @@ -162,7 +167,7 @@ module.exports = (baseProvider, options, app) => { }; }, - createDatabase({ + createSchema({ databaseName, isActivated = true, db_account, @@ -620,7 +625,7 @@ module.exports = (baseProvider, options, app) => { * @param {Array} containerData * @return {DropContainerData} */ - hydrateDropDatabase(containerData) { + hydrateDropSchema(containerData) { return { databaseName: containerData[0]?.name || '', }; @@ -631,7 +636,7 @@ module.exports = (baseProvider, options, app) => { * @param {ContainerCompModeData} compModeData * @return {ModifyContainerData} */ - hydrateAlterDatabase({ containerData, compModeData }) { + hydrateAlterSchema({ containerData, compModeData }) { const data = containerData[0] || {}; const isDbAccountModified = compModeData.new.db_account !== compModeData.old.db_account; @@ -890,7 +895,7 @@ module.exports = (baseProvider, options, app) => { * @param {DropContainerData} dropDbData * @return {string} */ - dropDatabase(dropDbData) { + dropSchema(dropDbData) { return assignTemplates(templates.dropDatabase, dropDbData); }, @@ -898,7 +903,7 @@ module.exports = (baseProvider, options, app) => { * @param {ModifyContainerData} alterDbData * @return {string} */ - alterDatabase(alterDbData) { + alterSchema(alterDbData) { const databaseOptions = getDatabaseOptions(alterDbData); return assignTemplates(templates.modifyDatabase, { @@ -1120,5 +1125,13 @@ module.exports = (baseProvider, options, app) => { this.createView(alterData, dbData, true), ].join('\n\n'); }, + + commentStatement(statement) { + return commentIfDeactivated(statement, { isActivated: false }); + }, + + prepareName(name) { + return getTableName(name); + }, }); }; diff --git a/forward_engineering/helpers/dropStatementProxy.js b/forward_engineering/helpers/dropStatementProxy.js index 2aebc99..9227159 100644 --- a/forward_engineering/helpers/dropStatementProxy.js +++ b/forward_engineering/helpers/dropStatementProxy.js @@ -5,7 +5,7 @@ const dropStatementProxy = return { ...ddlProvider, - ...['dropDatabase', 'dropTable', 'dropColumn', 'dropIndex', 'dropCheckConstraint', 'dropView'].reduce( + ...['dropSchema', 'dropTable', 'dropColumn', 'dropIndex', 'dropCheckConstraint', 'dropView'].reduce( (result, method) => { return { ...result, diff --git a/localization/en.json b/localization/en.json index 291c761..1187435 100644 --- a/localization/en.json +++ b/localization/en.json @@ -174,5 +174,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": "Database name", + "CUSTOM_SCRIPT_CONTAINER_VAR": "databaseName", + "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 b412abf..84dfa2b 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", @@ -179,6 +179,128 @@ making sure that you maintain a proper JSON format. "propertyType": "text", "propertyTooltip": "A database can contain only one default journal table. However, any table in a particular database can use a journal table in a different database. By default the journal tebale is created in the new database if none is specified." }, + { + "propertyName": "Custom scripts", + "propertyType": "block", + "propertyKeyword": "customScripts", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Before CREATE DATABASE", + "propertyKeyword": "beforeCreateContainer", + "propertyType": "block", + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Script", + "propertyKeyword": "script", + "propertyType": "details", + "markdown": false, + "template": "codeEditor", + "templateOptions": { + "editorDialect": "sql", + "customScriptVariables": true + } + } + ] + }, + { + "propertyName": "After CREATE DATABASE", + "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": "description", diff --git a/properties_pane/entity_level/entityLevelConfig.json b/properties_pane/entity_level/entityLevelConfig.json index 644de1e..d7b47f0 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", @@ -645,6 +645,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 9af28fe..611d3b1 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", @@ -144,6 +144,166 @@ making sure that you maintain a proper JSON format. "propertyType": "select", "options": ["Relational", "Dimensional", "Vault"] }, + { + "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 DATABASE", + "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 DATABASE", + "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 adffe29..e97e56d 100644 --- a/properties_pane/view_level/viewLevelConfig.json +++ b/properties_pane/view_level/viewLevelConfig.json @@ -19,6 +19,52 @@ "template": "textarea", "markdown": false }, + { + "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": "Comments", "propertyKeyword": "description",