Skip to content

Commit 6920d6a

Browse files
authored
HCK-9128: Handle indexes without name in PostgreSQL (#130)
* HCK-9128: Handle indexes without indxKey * HCK-9128: Handle indexes without indxKey * HCK-9128: fix config
1 parent 972faae commit 6920d6a

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

forward_engineering/ddlProvider/ddlHelpers/indexHelper.js

+6
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ const getValue = value => {
9494
};
9595

9696
const createIndex = (tableName, index, dbData, isParentActivated = true) => {
97+
const isNameEmpty = !index.indxName && index.ifNotExist;
98+
99+
if (!index.columns.length || isNameEmpty) {
100+
return '';
101+
}
102+
97103
const isUnique = index.unique && index.index_method === 'btree';
98104
const name = wrapInQuotes(index.indxName);
99105
const unique = isUnique ? ' UNIQUE' : '';

properties_pane/entity_level/entityLevelConfig.json

+31-1
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,29 @@ making sure that you maintain a proper JSON format.
883883
"propertyName": "Name",
884884
"propertyKeyword": "indxName",
885885
"propertyTooltip": "Optional, if not specified an automatic name will be assigned. Index name are needed to drop indexes and appear in error messages when a constraint is violated.",
886-
"propertyType": "text"
886+
"propertyType": "text",
887+
"dependency": {
888+
"type": "not",
889+
"values": [
890+
{
891+
"key": "ifNotExist",
892+
"value": true
893+
}
894+
]
895+
}
896+
},
897+
{
898+
"propertyName": "Name",
899+
"propertyKeyword": "indxName",
900+
"propertyTooltip": "",
901+
"propertyType": "text",
902+
"validation": {
903+
"required": true
904+
},
905+
"dependency": {
906+
"key": "ifNotExist",
907+
"value": true
908+
}
887909
},
888910
{
889911
"propertyName": "Activated",
@@ -1024,6 +1046,10 @@ making sure that you maintain a proper JSON format.
10241046
"dependency": {
10251047
"key": "index_method",
10261048
"value": "btree"
1049+
},
1050+
"validation": {
1051+
"required": true,
1052+
"minLength": 1
10271053
}
10281054
},
10291055
{
@@ -1068,6 +1094,10 @@ making sure that you maintain a proper JSON format.
10681094
"value": "brin"
10691095
}
10701096
]
1097+
},
1098+
"validation": {
1099+
"required": true,
1100+
"minLength": 1
10711101
}
10721102
},
10731103
{

0 commit comments

Comments
 (0)