Skip to content

Commit

Permalink
HCK-8971: include schema name in index name of DDL (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightlngale authored Dec 4, 2024
1 parent cc97ee8 commit 470ca09
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion forward_engineering/helpers/indexHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ const getIndexKeys = (keys, jsonSchema, definitions) => {
};
};

const getIndexName = ({ name, dbName }) => {
const indexName = replaceSpaceWithUnderscore(name);

if (!indexName) {
return '';
}

return dbName ? `${dbName}.${name}` : name;
};

const getIndexes = (containerData, entityData, jsonSchema, definitions, areColumnConstraintsAvailable) => {
if (areColumnConstraintsAvailable) {
return '';
Expand All @@ -75,7 +85,7 @@ const getIndexes = (containerData, entityData, jsonSchema, definitions, areColum
const { columns, isIndexActivated = true } = getIndexKeys(indexData.SecIndxKey, jsonSchema, definitions);

return getIndexStatement({
name: replaceSpaceWithUnderscore(indexData.name),
name: getIndexName({ name: indexData.name, dbName }),
dbName: dbName,
tableName: tableName,
columns,
Expand Down

0 comments on commit 470ca09

Please sign in to comment.