Map Store Removal: Remove unnecessary check in Jpa Connection Provider

Closes #26406

Signed-off-by: vramik <vramik@redhat.com>
This commit is contained in:
vramik 2024-03-01 18:41:16 +01:00 committed by Alexander Schwartz
parent 7afd75ba08
commit 4fc7e3d607
2 changed files with 4 additions and 23 deletions

View file

@ -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) {

View file

@ -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) {