This is an automated email from the ASF dual-hosted git repository. riemer pushed a commit to branch improve-migration-execution in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit b0f8755d83805920355c126af3ffe5f6621c3370 Author: Dominik Riemer <[email protected]> AuthorDate: Tue Feb 17 15:12:35 2026 +0100 refactor: Extract migration selection to method --- .../streampipes/service/core/StreamPipesCoreApplication.java | 8 +++++++- .../streampipes/service/core/migrations/MigrationsHandler.java | 7 +++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java index 95316cdda4..a893025c12 100644 --- a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java +++ b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java @@ -48,6 +48,8 @@ import org.apache.streampipes.resource.management.SpResourceManager; import org.apache.streampipes.service.base.BaseNetworkingConfig; import org.apache.streampipes.service.base.StreamPipesPrometheusConfig; import org.apache.streampipes.service.base.StreamPipesServiceBase; +import org.apache.streampipes.service.core.migrations.AvailableMigrations; +import org.apache.streampipes.service.core.migrations.Migration; import org.apache.streampipes.service.core.migrations.MigrationsHandler; import org.apache.streampipes.storage.api.pipeline.IPipelineStorage; import org.apache.streampipes.storage.api.system.ISpCoreConfigurationStorage; @@ -142,7 +144,7 @@ public class StreamPipesCoreApplication extends StreamPipesServiceBase { if (coreConfigStorage.exists()) { coreStatusManager.updateCoreStatus(SpCoreConfigurationStatus.MIGRATING); } - new MigrationsHandler().performMigrations(); + new MigrationsHandler().performMigrations(getMigrations()); } new ApplyDefaultRolesAndPrivilegesTask().execute(); @@ -185,6 +187,10 @@ public class StreamPipesCoreApplication extends StreamPipesServiceBase { }); } + protected List<Migration> getMigrations() { + return new AvailableMigrations().getAvailableMigrations(); + } + private boolean isConfigured() { return new UserStorage().existsDatabase(); } diff --git a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/MigrationsHandler.java b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/MigrationsHandler.java index e8f63eeb92..a3f9b7c0b2 100644 --- a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/MigrationsHandler.java +++ b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/MigrationsHandler.java @@ -23,15 +23,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; +import java.util.List; public class MigrationsHandler { private static final Logger LOG = LoggerFactory.getLogger(MigrationsHandler.class); - public void performMigrations() { - LOG.info("Checking for required migrations..."); - var availableMigrations = new AvailableMigrations().getAvailableMigrations(); - + public void performMigrations(List<Migration> availableMigrations) { + LOG.info("Running required migrations..."); availableMigrations.forEach(migration -> { if (migration.shouldExecute()) { LOG.info("Performing migration: {}", migration.getDescription());
