Skip to content

Commit

Permalink
HCK-8237: field single PK and UK should be mutually exclusive (#37)
Browse files Browse the repository at this point in the history
<!--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-8237"
title="HCK-8237" target="_blank"><img alt="Sub-task"
src="https://hackolade.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10316?size=medium"
/>HCK-8237</a> Single PK should not be also declared as single UK
(mutually exclusive) - config only?
  </td></table>
  <br />
 

<!--jira-description-action-hidden-marker-end-->
## Content

In this PR:
- I added hiding unique field property if it's already a single primary
and vice versa.
- added an adapter to remove a single "unique" property in case a field
is a single PK and a single UK simultaneously. In another case, both
properties would be hidden.
- allowed for a field to be checked as unique in case it is already a
part of a composite primary key.
  • Loading branch information
taras-dubyk authored Oct 4, 2024
1 parent 63c387f commit 0e6a1f8
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 13 deletions.
58 changes: 58 additions & 0 deletions adapter/0.2.11.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* Copyright © 2016-2018 by IntegrIT S.A. dba Hackolade. All rights reserved.
*
* The copyright to the computer software herein is the property of IntegrIT S.A.
* The software may be used and/or copied only with the written permission of
* IntegrIT S.A. or in accordance with the terms and conditions stipulated in
* the agreement/contract under which the software has been supplied.
*
* {
* "add": {
* "entity": [<names of new property>],
* "container": [<names of new property>],
* "model": [<names of new property>],
* "view": [<names of new property>],
* "field": {
* "<type>": [<names of new property>]
* }
* },
* "delete": {
* "entity": [<names of new property>],
* "container": [<names of new property>],
* "model": [<names of new property>],
* "view": [<names of new property>],
* "field": {
* "<type>": [<names of new property>]
* }
* },
* "modify": {
* "entity": [
* {
* "from": { <properties that identify record> },
* "to": { <properties that need to be changed> }
* }
* ],
* "container": [],
* "model": [],
* "view": [],
* "field": []
* },
* }
*/
{
"add": {},
"modify": {
"field": [
{
"from": {
"primaryKey": true,
"unique": true
},
"to": {
"unique": false
}
}
]
},
"delete": {}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
},
"FEScriptCommentsSupported": true,
"enableFetchSystemEntitiesCheckbox": true,
"discoverRelationships": true
"discoverRelationships": true,
"enableKeysMultipleAbrr": true
}
},
"description": "Hackolade plugin for IBM Db2",
Expand Down
88 changes: 76 additions & 12 deletions properties_pane/field_level/fieldLevelConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,13 @@ making sure that you maintain a proper JSON format.
]
}
]
},
{
"type": "not",
"values": {
"key": "unique",
"value": true
}
}
]
},
Expand Down Expand Up @@ -745,12 +752,21 @@ making sure that you maintain a proper JSON format.
"type": "or",
"values": [
{
"key": "compositePrimaryKey",
"value": false
"type": "or",
"values": [
{
"key": "primaryKey",
"value": false
},
{
"key": "primaryKey",
"exist": false
}
]
},
{
"key": "compositePrimaryKey",
"exist": false
"value": true
}
]
},
Expand Down Expand Up @@ -1332,6 +1348,13 @@ making sure that you maintain a proper JSON format.
]
}
]
},
{
"type": "not",
"values": {
"key": "unique",
"value": true
}
}
]
},
Expand Down Expand Up @@ -1458,12 +1481,21 @@ making sure that you maintain a proper JSON format.
"type": "or",
"values": [
{
"key": "compositePrimaryKey",
"value": false
"type": "or",
"values": [
{
"key": "primaryKey",
"value": false
},
{
"key": "primaryKey",
"exist": false
}
]
},
{
"key": "compositePrimaryKey",
"exist": false
"value": true
}
]
},
Expand Down Expand Up @@ -1882,6 +1914,13 @@ making sure that you maintain a proper JSON format.
]
}
]
},
{
"type": "not",
"values": {
"key": "unique",
"value": true
}
}
]
}
Expand Down Expand Up @@ -1995,12 +2034,21 @@ making sure that you maintain a proper JSON format.
"type": "or",
"values": [
{
"key": "compositePrimaryKey",
"value": false
"type": "or",
"values": [
{
"key": "primaryKey",
"value": false
},
{
"key": "primaryKey",
"exist": false
}
]
},
{
"key": "compositePrimaryKey",
"exist": false
"value": true
}
]
},
Expand Down Expand Up @@ -3079,6 +3127,13 @@ making sure that you maintain a proper JSON format.
]
}
]
},
{
"type": "not",
"values": {
"key": "unique",
"value": true
}
}
]
}
Expand Down Expand Up @@ -3212,12 +3267,21 @@ making sure that you maintain a proper JSON format.
"type": "or",
"values": [
{
"key": "compositePrimaryKey",
"value": false
"type": "or",
"values": [
{
"key": "primaryKey",
"value": false
},
{
"key": "primaryKey",
"exist": false
}
]
},
{
"key": "compositePrimaryKey",
"exist": false
"value": true
}
]
},
Expand Down

0 comments on commit 0e6a1f8

Please sign in to comment.