From 470ca09b369b6b7450e37595a91151304810836d Mon Sep 17 00:00:00 2001 From: Yevhenii Moroziuk Date: Wed, 4 Dec 2024 17:06:31 +0200 Subject: [PATCH] HCK-8971: include schema name in index name of DDL (#102) --- forward_engineering/helpers/indexHelper.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/forward_engineering/helpers/indexHelper.js b/forward_engineering/helpers/indexHelper.js index 94422db..92f8b38 100644 --- a/forward_engineering/helpers/indexHelper.js +++ b/forward_engineering/helpers/indexHelper.js @@ -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 ''; @@ -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,