Skip to content

Commit

Permalink
HCK-9128: Handle indexes without name in PostgreSQL (#130)
Browse files Browse the repository at this point in the history
* HCK-9128: Handle indexes without indxKey

* HCK-9128: Handle indexes without indxKey

* HCK-9128: fix config
  • Loading branch information
Nightlngale authored Dec 16, 2024
1 parent 972faae commit 6920d6a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
6 changes: 6 additions & 0 deletions forward_engineering/ddlProvider/ddlHelpers/indexHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ const getValue = value => {
};

const createIndex = (tableName, index, dbData, isParentActivated = true) => {
const isNameEmpty = !index.indxName && index.ifNotExist;

if (!index.columns.length || isNameEmpty) {
return '';
}

const isUnique = index.unique && index.index_method === 'btree';
const name = wrapInQuotes(index.indxName);
const unique = isUnique ? ' UNIQUE' : '';
Expand Down
32 changes: 31 additions & 1 deletion properties_pane/entity_level/entityLevelConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,29 @@ making sure that you maintain a proper JSON format.
"propertyName": "Name",
"propertyKeyword": "indxName",
"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.",
"propertyType": "text"
"propertyType": "text",
"dependency": {
"type": "not",
"values": [
{
"key": "ifNotExist",
"value": true
}
]
}
},
{
"propertyName": "Name",
"propertyKeyword": "indxName",
"propertyTooltip": "",
"propertyType": "text",
"validation": {
"required": true
},
"dependency": {
"key": "ifNotExist",
"value": true
}
},
{
"propertyName": "Activated",
Expand Down Expand Up @@ -1024,6 +1046,10 @@ making sure that you maintain a proper JSON format.
"dependency": {
"key": "index_method",
"value": "btree"
},
"validation": {
"required": true,
"minLength": 1
}
},
{
Expand Down Expand Up @@ -1068,6 +1094,10 @@ making sure that you maintain a proper JSON format.
"value": "brin"
}
]
},
"validation": {
"required": true,
"minLength": 1
}
},
{
Expand Down

0 comments on commit 6920d6a

Please sign in to comment.