From ca58aa7b3d6c6dd9dc4331c69011826efbe97853 Mon Sep 17 00:00:00 2001 From: Pedro Igor Date: Tue, 21 Dec 2021 23:25:06 -0800 Subject: [PATCH] [fixes #9250] - Wrong query when fetching last model version (#9251) --- .../database/jpa/QuarkusJpaConnectionProviderFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/database/jpa/QuarkusJpaConnectionProviderFactory.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/database/jpa/QuarkusJpaConnectionProviderFactory.java index fc887c16fa..1dd16d6a09 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/database/jpa/QuarkusJpaConnectionProviderFactory.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/storage/database/jpa/QuarkusJpaConnectionProviderFactory.java @@ -81,7 +81,7 @@ public final class QuarkusJpaConnectionProviderFactory implements JpaConnectionP public static final String QUERY_PROPERTY_PREFIX = "kc.query."; private static final Logger logger = Logger.getLogger(QuarkusJpaConnectionProviderFactory.class); - private static final String SQL_GET_LATEST_VERSION = "SELECT VERSION FROM %sMIGRATION_MODEL"; + private static final String SQL_GET_LATEST_VERSION = "SELECT VERSION FROM %sMIGRATION_MODEL ORDER BY UPDATE_TIME DESC"; enum MigrationStrategy { UPDATE, VALIDATE, MANUAL