From 4fc7e3d6076a105fad71e8e70cae90b342218fc4 Mon Sep 17 00:00:00 2001 From: vramik Date: Fri, 1 Mar 2024 18:41:16 +0100 Subject: [PATCH] Map Store Removal: Remove unnecessary check in Jpa Connection Provider Closes #26406 Signed-off-by: vramik --- .../jpa/DefaultJpaConnectionProviderFactory.java | 13 ++----------- .../QuarkusJpaConnectionProviderFactory.java | 14 ++------------ 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/model/jpa/src/main/java/org/keycloak/connections/jpa/DefaultJpaConnectionProviderFactory.java b/model/jpa/src/main/java/org/keycloak/connections/jpa/DefaultJpaConnectionProviderFactory.java index ba17fb9f04..6995bed57e 100755 --- a/model/jpa/src/main/java/org/keycloak/connections/jpa/DefaultJpaConnectionProviderFactory.java +++ b/model/jpa/src/main/java/org/keycloak/connections/jpa/DefaultJpaConnectionProviderFactory.java @@ -251,17 +251,8 @@ public class DefaultJpaConnectionProviderFactory implements JpaConnectionProvide startGlobalStats(session, globalStatsInterval); } - /* - * Migrate model is executed just in case following providers are "jpa". - * In Map Storage, there is an assumption that migrateModel is not needed. - */ - if ((Config.getProvider("realm") == null || "jpa".equals(Config.getProvider("realm"))) && - (Config.getProvider("client") == null || "jpa".equals(Config.getProvider("client"))) && - (Config.getProvider("clientScope") == null || "jpa".equals(Config.getProvider("clientScope")))) { - - logger.debug("Calling migrateModel"); - migrateModel(session); - } + logger.debug("Calling migrateModel"); + migrateModel(session); } finally { // Close after creating EntityManagerFactory to prevent in-mem databases from closing if (connection != null) { diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/legacy/database/QuarkusJpaConnectionProviderFactory.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/legacy/database/QuarkusJpaConnectionProviderFactory.java index 4a76a87009..6d9fdbf4d3 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/legacy/database/QuarkusJpaConnectionProviderFactory.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/legacy/database/QuarkusJpaConnectionProviderFactory.java @@ -38,7 +38,6 @@ import jakarta.persistence.EntityManagerFactory; import io.quarkus.arc.Arc; import org.jboss.logging.Logger; -import org.keycloak.Config; import org.keycloak.ServerStartupError; import org.keycloak.common.Version; import org.keycloak.connections.jpa.DefaultJpaConnectionProvider; @@ -195,17 +194,8 @@ public class QuarkusJpaConnectionProviderFactory extends AbstractJpaConnectionPr } private void initSchema(KeycloakSession session) { - /* - * Migrate model is executed just in case following providers are "jpa". - * In Map Storage, there is an assumption that migrateModel is not needed. - */ - if ((Config.getProvider("realm") == null || "jpa".equals(Config.getProvider("realm"))) && - (Config.getProvider("client") == null || "jpa".equals(Config.getProvider("client"))) && - (Config.getProvider("clientScope") == null || "jpa".equals(Config.getProvider("clientScope")))) { - - logger.debug("Calling migrateModel"); - migrateModel(session); - } + logger.debug("Calling migrateModel"); + migrateModel(session); } private void migrateModel(KeycloakSession session) {