Skip to content

Commit

Permalink
HCK-9128: Handle indexes without name in CockroachDB (#35)
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 60d3e4b commit 17d1f9c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
6 changes: 6 additions & 0 deletions forward_engineering/ddlProvider/ddlProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ module.exports = (baseProvider, options, app) => {
},

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
26 changes: 25 additions & 1 deletion properties_pane/entity_level/entityLevelConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,27 @@ 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 @@ -643,6 +663,10 @@ making sure that you maintain a proper JSON format.
"options": ["", "NULLS FIRST", "NULLS LAST"],
"propertyTooltip": "Specifies that nulls sort order"
}
},
"validation": {
"minLength": 1,
"required": true
}
},
{
Expand Down

0 comments on commit 17d1f9c

Please sign in to comment.