Merge branch 'feature/RED-9348' into 'main'

RED-9348: Move component log to Mongo

See merge request fforesight/mongo-database-commons!15
This commit is contained in:
Maverick Studer 2024-09-23 16:05:31 +02:00
commit 987e720dad
2 changed files with 9 additions and 0 deletions

View File

@ -18,4 +18,5 @@ deploy:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH =~ /^release/
- if: $CI_COMMIT_BRANCH =~ /^feature/
- if: $CI_COMMIT_TAG

View File

@ -1,6 +1,8 @@
package com.knecon.fforesight.mongo.database.commons.liquibase;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties;
@ -96,6 +98,12 @@ public class TenantMongoLiquibaseExecutor implements InitializingBean, ResourceL
liquibase.setChangeLog(tenantMongoLiquibaseProperties.getChangeLog());
liquibase.setContexts(tenantMongoLiquibaseProperties.getContexts());
liquibase.setClearCheckSums(tenantMongoLiquibaseProperties.isClearChecksums());
String databaseName = database.getConnection().getCatalog(); // or getDatabaseName() depending on your implementation
Map<String, String> changeLogParameters = new HashMap<>();
changeLogParameters.put("databaseName", databaseName);
liquibase.setChangeLogParameters(changeLogParameters);
liquibase.afterPropertiesSet();
}