Skip to content

Commit d64cb07

Browse files
HCK-14977: Custom scripts - regular model (#56)
1 parent bec41ba commit d64cb07

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
@@ -755,6 +755,14 @@ module.exports = (baseProvider, options, app) => {
755755
return statement;
756756
},
757757

758+
commentStatement(statement) {
759+
return commentIfDeactivated(statement, { isActivated: false });
760+
},
761+
762+
prepareName(name) {
763+
return wrapInQuotes(name);
764+
},
765+
758766
/**
759767
* @param tableName {string}
760768
* @param columnName {string}

localization/en.json

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

properties_pane/container_level/containerLevelConfig.json

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,128 @@ making sure that you maintain a proper JSON format.
125125
"defaultValue": true,
126126
"propertyType": "checkbox"
127127
},
128+
{
129+
"propertyName": "Custom scripts",
130+
"propertyType": "block",
131+
"propertyKeyword": "customScripts",
132+
"propertyTooltip": "",
133+
"structure": [
134+
{
135+
"propertyName": "Before CREATE SCHEMA",
136+
"propertyKeyword": "beforeCreateContainer",
137+
"propertyType": "block",
138+
"propertyTooltip": "",
139+
"structure": [
140+
{
141+
"propertyName": "Script",
142+
"propertyKeyword": "script",
143+
"propertyType": "details",
144+
"markdown": false,
145+
"template": "codeEditor",
146+
"templateOptions": {
147+
"editorDialect": "sql",
148+
"customScriptVariables": true
149+
}
150+
}
151+
]
152+
},
153+
{
154+
"propertyName": "After CREATE SCHEMA",
155+
"propertyKeyword": "afterCreateContainer",
156+
"propertyType": "block",
157+
"propertyTooltip": "",
158+
"structure": [
159+
{
160+
"propertyName": "Script",
161+
"propertyKeyword": "script",
162+
"propertyType": "details",
163+
"markdown": false,
164+
"template": "codeEditor",
165+
"templateOptions": {
166+
"editorDialect": "sql",
167+
"customScriptVariables": true
168+
}
169+
}
170+
]
171+
},
172+
{
173+
"propertyName": "Before each CREATE TABLE",
174+
"propertyKeyword": "beforeCreateEntity",
175+
"propertyType": "block",
176+
"propertyTooltip": "",
177+
"structure": [
178+
{
179+
"propertyName": "Script",
180+
"propertyKeyword": "script",
181+
"propertyType": "details",
182+
"markdown": false,
183+
"template": "codeEditor",
184+
"templateOptions": {
185+
"editorDialect": "sql",
186+
"customScriptVariables": true
187+
}
188+
}
189+
]
190+
},
191+
{
192+
"propertyName": "After each CREATE TABLE",
193+
"propertyKeyword": "afterCreateEntity",
194+
"propertyType": "block",
195+
"propertyTooltip": "",
196+
"structure": [
197+
{
198+
"propertyName": "Script",
199+
"propertyKeyword": "script",
200+
"propertyType": "details",
201+
"markdown": false,
202+
"template": "codeEditor",
203+
"templateOptions": {
204+
"editorDialect": "sql",
205+
"customScriptVariables": true
206+
}
207+
}
208+
]
209+
},
210+
{
211+
"propertyName": "Before each CREATE VIEW",
212+
"propertyKeyword": "beforeCreateView",
213+
"propertyType": "block",
214+
"propertyTooltip": "",
215+
"structure": [
216+
{
217+
"propertyName": "Script",
218+
"propertyKeyword": "script",
219+
"propertyType": "details",
220+
"markdown": false,
221+
"template": "codeEditor",
222+
"templateOptions": {
223+
"editorDialect": "sql",
224+
"customScriptVariables": true
225+
}
226+
}
227+
]
228+
},
229+
{
230+
"propertyName": "After each CREATE VIEW",
231+
"propertyKeyword": "afterCreateView",
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+
},
128250
{
129251
"propertyName": "Remarks",
130252
"propertyKeyword": "comments",

properties_pane/entity_level/entityLevelConfig.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,52 @@ making sure that you maintain a proper JSON format.
357357
},
358358
"markdown": false
359359
},
360+
{
361+
"propertyName": "Custom scripts",
362+
"propertyType": "block",
363+
"propertyKeyword": "customScripts",
364+
"propertyTooltip": "",
365+
"structure": [
366+
{
367+
"propertyName": "Before CREATE TABLE",
368+
"propertyKeyword": "beforeCreateEntity",
369+
"propertyType": "block",
370+
"propertyTooltip": "",
371+
"structure": [
372+
{
373+
"propertyName": "Script",
374+
"propertyKeyword": "script",
375+
"propertyType": "details",
376+
"markdown": false,
377+
"template": "codeEditor",
378+
"templateOptions": {
379+
"editorDialect": "sql",
380+
"customScriptVariables": true
381+
}
382+
}
383+
]
384+
},
385+
{
386+
"propertyName": "After CREATE TABLE",
387+
"propertyKeyword": "afterCreateEntity",
388+
"propertyType": "block",
389+
"propertyTooltip": "",
390+
"structure": [
391+
{
392+
"propertyName": "Script",
393+
"propertyKeyword": "script",
394+
"propertyType": "details",
395+
"markdown": false,
396+
"template": "codeEditor",
397+
"templateOptions": {
398+
"editorDialect": "sql",
399+
"customScriptVariables": true
400+
}
401+
}
402+
]
403+
}
404+
]
405+
},
360406
{
361407
"propertyName": "Remarks",
362408
"propertyKeyword": "comments",

properties_pane/model_level/modelLevelConfig.json

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,166 @@ making sure that you maintain a proper JSON format.
104104
"propertyTooltip": "Character classification (LC_CTYPE) to use in the new database. ",
105105
"propertyType": "text"
106106
},
107+
{
108+
"propertyName": "Custom scripts",
109+
"propertyType": "block",
110+
"propertyKeyword": "customScripts",
111+
"propertyTooltip": "",
112+
"structure": [
113+
{
114+
"propertyName": "Header script",
115+
"propertyKeyword": "headerScript",
116+
"propertyType": "block",
117+
"propertyTooltip": "",
118+
"structure": [
119+
{
120+
"propertyName": "Script",
121+
"propertyKeyword": "script",
122+
"propertyType": "details",
123+
"markdown": false,
124+
"template": "codeEditor",
125+
"templateOptions": {
126+
"editorDialect": "sql",
127+
"customScriptVariables": true
128+
}
129+
}
130+
]
131+
},
132+
{
133+
"propertyName": "Footer script",
134+
"propertyKeyword": "footerScript",
135+
"propertyType": "block",
136+
"propertyTooltip": "",
137+
"structure": [
138+
{
139+
"propertyName": "Script",
140+
"propertyKeyword": "script",
141+
"propertyType": "details",
142+
"markdown": false,
143+
"template": "codeEditor",
144+
"templateOptions": {
145+
"editorDialect": "sql",
146+
"customScriptVariables": true
147+
}
148+
}
149+
]
150+
},
151+
{
152+
"propertyName": "Before each CREATE SCHEMA",
153+
"propertyKeyword": "beforeCreateContainer",
154+
"propertyType": "block",
155+
"propertyTooltip": "",
156+
"structure": [
157+
{
158+
"propertyName": "Script",
159+
"propertyKeyword": "script",
160+
"propertyType": "details",
161+
"markdown": false,
162+
"template": "codeEditor",
163+
"templateOptions": {
164+
"editorDialect": "sql",
165+
"customScriptVariables": true
166+
}
167+
}
168+
]
169+
},
170+
{
171+
"propertyName": "After each CREATE SCHEMA",
172+
"propertyKeyword": "afterCreateContainer",
173+
"propertyType": "block",
174+
"propertyTooltip": "",
175+
"structure": [
176+
{
177+
"propertyName": "Script",
178+
"propertyKeyword": "script",
179+
"propertyType": "details",
180+
"markdown": false,
181+
"template": "codeEditor",
182+
"templateOptions": {
183+
"editorDialect": "sql",
184+
"customScriptVariables": true
185+
}
186+
}
187+
]
188+
},
189+
{
190+
"propertyName": "Before each CREATE TABLE",
191+
"propertyKeyword": "beforeCreateEntity",
192+
"propertyType": "block",
193+
"propertyTooltip": "",
194+
"structure": [
195+
{
196+
"propertyName": "Script",
197+
"propertyKeyword": "script",
198+
"propertyType": "details",
199+
"markdown": false,
200+
"template": "codeEditor",
201+
"templateOptions": {
202+
"editorDialect": "sql",
203+
"customScriptVariables": true
204+
}
205+
}
206+
]
207+
},
208+
{
209+
"propertyName": "After each CREATE TABLE",
210+
"propertyKeyword": "afterCreateEntity",
211+
"propertyType": "block",
212+
"propertyTooltip": "",
213+
"structure": [
214+
{
215+
"propertyName": "Script",
216+
"propertyKeyword": "script",
217+
"propertyType": "details",
218+
"markdown": false,
219+
"template": "codeEditor",
220+
"templateOptions": {
221+
"editorDialect": "sql",
222+
"customScriptVariables": true
223+
}
224+
}
225+
]
226+
},
227+
{
228+
"propertyName": "Before each CREATE VIEW",
229+
"propertyKeyword": "beforeCreateView",
230+
"propertyType": "block",
231+
"propertyTooltip": "",
232+
"structure": [
233+
{
234+
"propertyName": "Script",
235+
"propertyKeyword": "script",
236+
"propertyType": "details",
237+
"markdown": false,
238+
"template": "codeEditor",
239+
"templateOptions": {
240+
"editorDialect": "sql",
241+
"customScriptVariables": true
242+
}
243+
}
244+
]
245+
},
246+
{
247+
"propertyName": "After each CREATE VIEW",
248+
"propertyKeyword": "afterCreateView",
249+
"propertyType": "block",
250+
"propertyTooltip": "",
251+
"structure": [
252+
{
253+
"propertyName": "Script",
254+
"propertyKeyword": "script",
255+
"propertyType": "details",
256+
"markdown": false,
257+
"template": "codeEditor",
258+
"templateOptions": {
259+
"editorDialect": "sql",
260+
"customScriptVariables": true
261+
}
262+
}
263+
]
264+
}
265+
]
266+
},
107267
{
108268
"propertyName": "Comments",
109269
"propertyKeyword": "comments",

0 commit comments

Comments
 (0)