-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HCK-8696: add filtering of duplicated indexes columns for case with i…
…ndexes on partitioned tables (#121) * HCK-8696: add filtering of duplicated indexes columns for case with indexes on partitioned tables * HCK-8696: removed redundant Boolean call
- Loading branch information
1 parent
c05efdf
commit 225bfdb
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
reverse_engineering/reverseEngineeringService/helpers/getUniqueIndexesColumns.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const getColumnUniqueKey = ({ IndexName, TableName, schemaName, columnName }) => | ||
`${schemaName}${IndexName}${TableName}${columnName}`; | ||
|
||
const getUniqueIndexesColumns = ({ indexesColumns }) => { | ||
const uniqueKeysToColumns = {}; | ||
|
||
for (const indexesColumn of indexesColumns) { | ||
const columnKey = getColumnUniqueKey(indexesColumn); | ||
const isColumnUnique = !uniqueKeysToColumns[columnKey]; | ||
|
||
if (!isColumnUnique) { | ||
continue; | ||
} | ||
|
||
uniqueKeysToColumns[columnKey] = indexesColumn; | ||
} | ||
|
||
return Object.values(uniqueKeysToColumns); | ||
}; | ||
|
||
module.exports = { | ||
getUniqueIndexesColumns, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters