Skip to content

Commit 38a81e2

Browse files
HCK-14977: Custom scripts - regular model (#94)
<!--do not remove this marker, its needed to replace info when ticket title is updated --> <!--jira-description-action-hidden-marker-start--> <table> <td> <a href="https://hackolade.atlassian.net/browse/HCK-14977" title="HCK-14977" target="_blank"><img alt="Sub-task" src="https://hackolade.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10316?size=medium" />HCK-14977</a> Enable custom script for all plugins using ddlProvider (Alik knows 😄) </td></table> <br /> <!--jira-description-action-hidden-marker-end-->
1 parent 82254e9 commit 38a81e2

6 files changed

Lines changed: 388 additions & 1 deletion

File tree

forward_engineering/ddlProvider/ddlProvider.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,5 +531,13 @@ module.exports = (baseProvider, options, app) => {
531531
commentIfDeactivated(statement, data, isPartOfLine) {
532532
return statement;
533533
},
534+
535+
commentStatement(statement) {
536+
return commentIfDeactivated(statement, { isActivated: false });
537+
},
538+
539+
prepareName(name) {
540+
return wrapInQuotes(name);
541+
},
534542
};
535543
};

localization/en.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,5 +158,10 @@
158158
"MODAL_WINDOW___OPTIONS_DISPLAY_ERD_V_ENTITY_BOX_CONTENT": "Display of table box content",
159159
"MODAL_WINDOW___OPTIONS_DISPLAY_ERD_V_FIELDS": "Columns",
160160
"MODAL_WINDOW___OPTIONS_DISPLAY_REQUIRED_ATTRIBUTES": "Required columns",
161-
"MODAL_WINDOW___OPTIONS_DISPLAY_NULLABLE_ATTRIBUTES": "Nullable columns"
161+
"MODAL_WINDOW___OPTIONS_DISPLAY_NULLABLE_ATTRIBUTES": "Nullable columns",
162+
163+
"CUSTOM_SCRIPT_CONTAINER_VAR_NAME": "Schema name",
164+
"CUSTOM_SCRIPT_CONTAINER_VAR": "schemaName",
165+
"CUSTOM_SCRIPT_ENTITY_VAR_NAME": "Table name",
166+
"CUSTOM_SCRIPT_ENTITY_VAR": "tableName"
162167
}

properties_pane/container_level/containerLevelConfig.json

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,128 @@ making sure that you maintain a proper JSON format.
132132
"propertyType": "select",
133133
"options": ["", "NONE", "CHANGES"]
134134
},
135+
{
136+
"propertyName": "Custom scripts",
137+
"propertyType": "block",
138+
"propertyKeyword": "customScripts",
139+
"propertyTooltip": "",
140+
"structure": [
141+
{
142+
"propertyName": "Before CREATE SCHEMA",
143+
"propertyKeyword": "beforeCreateContainer",
144+
"propertyType": "block",
145+
"propertyTooltip": "",
146+
"structure": [
147+
{
148+
"propertyName": "Script",
149+
"propertyKeyword": "script",
150+
"propertyType": "details",
151+
"markdown": false,
152+
"template": "codeEditor",
153+
"templateOptions": {
154+
"editorDialect": "sql",
155+
"customScriptVariables": true
156+
}
157+
}
158+
]
159+
},
160+
{
161+
"propertyName": "After CREATE SCHEMA",
162+
"propertyKeyword": "afterCreateContainer",
163+
"propertyType": "block",
164+
"propertyTooltip": "",
165+
"structure": [
166+
{
167+
"propertyName": "Script",
168+
"propertyKeyword": "script",
169+
"propertyType": "details",
170+
"markdown": false,
171+
"template": "codeEditor",
172+
"templateOptions": {
173+
"editorDialect": "sql",
174+
"customScriptVariables": true
175+
}
176+
}
177+
]
178+
},
179+
{
180+
"propertyName": "Before each CREATE TABLE",
181+
"propertyKeyword": "beforeCreateEntity",
182+
"propertyType": "block",
183+
"propertyTooltip": "",
184+
"structure": [
185+
{
186+
"propertyName": "Script",
187+
"propertyKeyword": "script",
188+
"propertyType": "details",
189+
"markdown": false,
190+
"template": "codeEditor",
191+
"templateOptions": {
192+
"editorDialect": "sql",
193+
"customScriptVariables": true
194+
}
195+
}
196+
]
197+
},
198+
{
199+
"propertyName": "After each CREATE TABLE",
200+
"propertyKeyword": "afterCreateEntity",
201+
"propertyType": "block",
202+
"propertyTooltip": "",
203+
"structure": [
204+
{
205+
"propertyName": "Script",
206+
"propertyKeyword": "script",
207+
"propertyType": "details",
208+
"markdown": false,
209+
"template": "codeEditor",
210+
"templateOptions": {
211+
"editorDialect": "sql",
212+
"customScriptVariables": true
213+
}
214+
}
215+
]
216+
},
217+
{
218+
"propertyName": "Before each CREATE VIEW",
219+
"propertyKeyword": "beforeCreateView",
220+
"propertyType": "block",
221+
"propertyTooltip": "",
222+
"structure": [
223+
{
224+
"propertyName": "Script",
225+
"propertyKeyword": "script",
226+
"propertyType": "details",
227+
"markdown": false,
228+
"template": "codeEditor",
229+
"templateOptions": {
230+
"editorDialect": "sql",
231+
"customScriptVariables": true
232+
}
233+
}
234+
]
235+
},
236+
{
237+
"propertyName": "After each CREATE VIEW",
238+
"propertyKeyword": "afterCreateView",
239+
"propertyType": "block",
240+
"propertyTooltip": "",
241+
"structure": [
242+
{
243+
"propertyName": "Script",
244+
"propertyKeyword": "script",
245+
"propertyType": "details",
246+
"markdown": false,
247+
"template": "codeEditor",
248+
"templateOptions": {
249+
"editorDialect": "sql",
250+
"customScriptVariables": true
251+
}
252+
}
253+
]
254+
}
255+
]
256+
},
135257
{
136258
"propertyName": "Remarks",
137259
"propertyKeyword": "comments",

properties_pane/entity_level/entityLevelConfig.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,52 @@ making sure that you maintain a proper JSON format.
220220
"propertyTooltip": "Enter the name of an existing tablespace location for the table",
221221
"propertyType": "text"
222222
},
223+
{
224+
"propertyName": "Custom scripts",
225+
"propertyType": "block",
226+
"propertyKeyword": "customScripts",
227+
"propertyTooltip": "",
228+
"structure": [
229+
{
230+
"propertyName": "Before CREATE TABLE",
231+
"propertyKeyword": "beforeCreateEntity",
232+
"propertyType": "block",
233+
"propertyTooltip": "",
234+
"structure": [
235+
{
236+
"propertyName": "Script",
237+
"propertyKeyword": "script",
238+
"propertyType": "details",
239+
"markdown": false,
240+
"template": "codeEditor",
241+
"templateOptions": {
242+
"editorDialect": "sql",
243+
"customScriptVariables": true
244+
}
245+
}
246+
]
247+
},
248+
{
249+
"propertyName": "After CREATE TABLE",
250+
"propertyKeyword": "afterCreateEntity",
251+
"propertyType": "block",
252+
"propertyTooltip": "",
253+
"structure": [
254+
{
255+
"propertyName": "Script",
256+
"propertyKeyword": "script",
257+
"propertyType": "details",
258+
"markdown": false,
259+
"template": "codeEditor",
260+
"templateOptions": {
261+
"editorDialect": "sql",
262+
"customScriptVariables": true
263+
}
264+
}
265+
]
266+
}
267+
]
268+
},
223269
{
224270
"propertyName": "Remarks",
225271
"propertyKeyword": "comments",

properties_pane/model_level/modelLevelConfig.json

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,166 @@ making sure that you maintain a proper JSON format.
138138
]
139139
}
140140
},
141+
{
142+
"propertyName": "Custom scripts",
143+
"propertyType": "block",
144+
"propertyKeyword": "customScripts",
145+
"propertyTooltip": "",
146+
"structure": [
147+
{
148+
"propertyName": "Header script",
149+
"propertyKeyword": "headerScript",
150+
"propertyType": "block",
151+
"propertyTooltip": "",
152+
"structure": [
153+
{
154+
"propertyName": "Script",
155+
"propertyKeyword": "script",
156+
"propertyType": "details",
157+
"markdown": false,
158+
"template": "codeEditor",
159+
"templateOptions": {
160+
"editorDialect": "sql",
161+
"customScriptVariables": true
162+
}
163+
}
164+
]
165+
},
166+
{
167+
"propertyName": "Footer script",
168+
"propertyKeyword": "footerScript",
169+
"propertyType": "block",
170+
"propertyTooltip": "",
171+
"structure": [
172+
{
173+
"propertyName": "Script",
174+
"propertyKeyword": "script",
175+
"propertyType": "details",
176+
"markdown": false,
177+
"template": "codeEditor",
178+
"templateOptions": {
179+
"editorDialect": "sql",
180+
"customScriptVariables": true
181+
}
182+
}
183+
]
184+
},
185+
{
186+
"propertyName": "Before each CREATE SCHEMA",
187+
"propertyKeyword": "beforeCreateContainer",
188+
"propertyType": "block",
189+
"propertyTooltip": "",
190+
"structure": [
191+
{
192+
"propertyName": "Script",
193+
"propertyKeyword": "script",
194+
"propertyType": "details",
195+
"markdown": false,
196+
"template": "codeEditor",
197+
"templateOptions": {
198+
"editorDialect": "sql",
199+
"customScriptVariables": true
200+
}
201+
}
202+
]
203+
},
204+
{
205+
"propertyName": "After each CREATE SCHEMA",
206+
"propertyKeyword": "afterCreateContainer",
207+
"propertyType": "block",
208+
"propertyTooltip": "",
209+
"structure": [
210+
{
211+
"propertyName": "Script",
212+
"propertyKeyword": "script",
213+
"propertyType": "details",
214+
"markdown": false,
215+
"template": "codeEditor",
216+
"templateOptions": {
217+
"editorDialect": "sql",
218+
"customScriptVariables": true
219+
}
220+
}
221+
]
222+
},
223+
{
224+
"propertyName": "Before each CREATE TABLE",
225+
"propertyKeyword": "beforeCreateEntity",
226+
"propertyType": "block",
227+
"propertyTooltip": "",
228+
"structure": [
229+
{
230+
"propertyName": "Script",
231+
"propertyKeyword": "script",
232+
"propertyType": "details",
233+
"markdown": false,
234+
"template": "codeEditor",
235+
"templateOptions": {
236+
"editorDialect": "sql",
237+
"customScriptVariables": true
238+
}
239+
}
240+
]
241+
},
242+
{
243+
"propertyName": "After each CREATE TABLE",
244+
"propertyKeyword": "afterCreateEntity",
245+
"propertyType": "block",
246+
"propertyTooltip": "",
247+
"structure": [
248+
{
249+
"propertyName": "Script",
250+
"propertyKeyword": "script",
251+
"propertyType": "details",
252+
"markdown": false,
253+
"template": "codeEditor",
254+
"templateOptions": {
255+
"editorDialect": "sql",
256+
"customScriptVariables": true
257+
}
258+
}
259+
]
260+
},
261+
{
262+
"propertyName": "Before each CREATE VIEW",
263+
"propertyKeyword": "beforeCreateView",
264+
"propertyType": "block",
265+
"propertyTooltip": "",
266+
"structure": [
267+
{
268+
"propertyName": "Script",
269+
"propertyKeyword": "script",
270+
"propertyType": "details",
271+
"markdown": false,
272+
"template": "codeEditor",
273+
"templateOptions": {
274+
"editorDialect": "sql",
275+
"customScriptVariables": true
276+
}
277+
}
278+
]
279+
},
280+
{
281+
"propertyName": "After each CREATE VIEW",
282+
"propertyKeyword": "afterCreateView",
283+
"propertyType": "block",
284+
"propertyTooltip": "",
285+
"structure": [
286+
{
287+
"propertyName": "Script",
288+
"propertyKeyword": "script",
289+
"propertyType": "details",
290+
"markdown": false,
291+
"template": "codeEditor",
292+
"templateOptions": {
293+
"editorDialect": "sql",
294+
"customScriptVariables": true
295+
}
296+
}
297+
]
298+
}
299+
]
300+
},
141301
{
142302
"propertyName": "Comments",
143303
"propertyKeyword": "comments",

0 commit comments

Comments
 (0)