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); 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"); logger.debug("Calling migrateModel");
migrateModel(session); migrateModel(session);
}
} finally { } finally {
// Close after creating EntityManagerFactory to prevent in-mem databases from closing // Close after creating EntityManagerFactory to prevent in-mem databases from closing
if (connection != null) { if (connection != null) {

View file

@ -38,7 +38,6 @@ import jakarta.persistence.EntityManagerFactory;
import io.quarkus.arc.Arc; import io.quarkus.arc.Arc;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.keycloak.Config;
import org.keycloak.ServerStartupError; import org.keycloak.ServerStartupError;
import org.keycloak.common.Version; import org.keycloak.common.Version;
import org.keycloak.connections.jpa.DefaultJpaConnectionProvider; import org.keycloak.connections.jpa.DefaultJpaConnectionProvider;
@ -195,18 +194,9 @@ public class QuarkusJpaConnectionProviderFactory extends AbstractJpaConnectionPr
} }
private void initSchema(KeycloakSession session) { 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"); logger.debug("Calling migrateModel");
migrateModel(session); migrateModel(session);
} }
}
private void migrateModel(KeycloakSession session) { private void migrateModel(KeycloakSession session) {
try { try {