From 0f351a0e13c87e0df09d6b0b83d6f86aed0c8bdf Mon Sep 17 00:00:00 2001 From: Maverick Studer Date: Mon, 23 Sep 2024 16:05:31 +0200 Subject: [PATCH] RED-9348: Move component log to Mongo --- .gitlab-ci.yml | 1 + .../commons/liquibase/TenantMongoLiquibaseExecutor.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b17158..2724593 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 \ No newline at end of file diff --git a/src/main/java/com/knecon/fforesight/mongo/database/commons/liquibase/TenantMongoLiquibaseExecutor.java b/src/main/java/com/knecon/fforesight/mongo/database/commons/liquibase/TenantMongoLiquibaseExecutor.java index c096208..ae7199f 100644 --- a/src/main/java/com/knecon/fforesight/mongo/database/commons/liquibase/TenantMongoLiquibaseExecutor.java +++ b/src/main/java/com/knecon/fforesight/mongo/database/commons/liquibase/TenantMongoLiquibaseExecutor.java @@ -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 changeLogParameters = new HashMap<>(); + changeLogParameters.put("databaseName", databaseName); + liquibase.setChangeLogParameters(changeLogParameters); + liquibase.afterPropertiesSet(); }