Update to Liquibase 4.8.0

Closes #10678

Co-authored-by: Stefan Guilhen <sguilhen@redhat.com>
Co-authored-by: Martin Kanis <mkanis@redhat.com>
This commit is contained in:
Bruno Oliveira da Silva 2022-03-10 16:54:56 -03:00
parent 842218a7ed
commit 8aa394ca6b
9 changed files with 25 additions and 9 deletions

View file

@ -81,11 +81,11 @@
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>4.6.2</version>
<version>4.8.0</version>
<licenses>
<license>
<name>Apache Software License 2.0</name>
<url>https://raw.githubusercontent.com/liquibase/liquibase/v4.6.2/LICENSE.txt</url>
<url>https://raw.githubusercontent.com/liquibase/liquibase/v4.8.0/LICENSE.txt</url>
</license>
</licenses>
</dependency>

View file

@ -81,11 +81,11 @@
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>4.6.2.redhat-00001</version>
<version>4.8.0.redhat-00001</version>
<licenses>
<license>
<name>Apache Software License 2.0</name>
<url>https://raw.githubusercontent.com/liquibase/liquibase/v4.6.2/LICENSE.txt</url>
<url>https://raw.githubusercontent.com/liquibase/liquibase/v4.8.0/LICENSE.txt</url>
</license>
</licenses>
</dependency>

View file

@ -96,11 +96,11 @@
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.6.2</version>
<version>4.8.0</version>
<licenses>
<license>
<name>Apache Software License 2.0</name>
<url>https://raw.githubusercontent.com/liquibase/liquibase/v4.6.2/LICENSE.txt</url>
<url>https://raw.githubusercontent.com/liquibase/liquibase/v4.8.0/LICENSE.txt</url>
</license>
</licenses>
</dependency>

View file

@ -81,11 +81,11 @@
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>4.6.2.redhat-00001</version>
<version>4.8.0.redhat-00001</version>
<licenses>
<license>
<name>Apache Software License 2.0</name>
<url>https://raw.githubusercontent.com/liquibase/liquibase/v4.6.2/LICENSE.txt</url>
<url>https://raw.githubusercontent.com/liquibase/liquibase/v4.8.0/LICENSE.txt</url>
</license>
</licenses>
</dependency>

View file

@ -26,6 +26,7 @@ import liquibase.database.jvm.JdbcConnection;
import liquibase.exception.LiquibaseException;
import liquibase.resource.ClassLoaderResourceAccessor;
import liquibase.resource.ResourceAccessor;
import liquibase.ui.LoggerUIService;
import org.jboss.logging.Logger;
import org.keycloak.Config;
import org.keycloak.connections.jpa.updater.liquibase.LiquibaseJpaUpdaterProvider;
@ -81,6 +82,7 @@ public class DefaultLiquibaseConnectionProvider implements LiquibaseConnectionPr
final Map<String, Object> scopeValues = new HashMap<>();
scopeValues.put(Scope.Attr.resourceAccessor.name(), new ClassLoaderResourceAccessor(this.getClass().getClassLoader()));
scopeValues.put(Scope.Attr.classLoader.name(), this.getClass().getClassLoader());
scopeValues.put(Scope.Attr.ui.name(), new LoggerUIService());
try {
Scope.enter(scopeValues);
} catch (Exception e) {

View file

@ -137,7 +137,7 @@
<freemarker.version>2.3.31</freemarker.version>
<jetty9.version>${jetty92.version}</jetty9.version>
<liquibase.version>4.6.2</liquibase.version>
<liquibase.version>4.8.0</liquibase.version>
<osgi.version>4.2.0</osgi.version>
<pax.web.version>7.1.0</pax.web.version>
<servlet.api.30.version>1.0.2.Final</servlet.api.30.version>

View file

@ -19,9 +19,13 @@ package org.keycloak.quarkus.runtime.storage.database.liquibase;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;
import javax.xml.parsers.SAXParserFactory;
import liquibase.Scope;
import liquibase.ui.LoggerUIService;
import org.jboss.logging.Logger;
import org.keycloak.Config;
import org.keycloak.connections.jpa.updater.liquibase.conn.LiquibaseConnectionProvider;
@ -63,6 +67,16 @@ public class QuarkusLiquibaseConnectionProvider implements LiquibaseConnectionPr
protected void baseLiquibaseInitialization(KeycloakSession session) {
resourceAccessor = new ClassLoaderResourceAccessor(getClass().getClassLoader());
// initialize Liquibase using a custom scope
final Map<String, Object> scopeValues = new HashMap<>();
scopeValues.put(Scope.Attr.ui.name(), new LoggerUIService());
try {
Scope scope = Scope.getCurrentScope();
scope.enter(scopeValues);
} catch (Exception e) {
throw new RuntimeException("Failed to initialize Liquibase: " + e.getMessage(), e);
}
// disables XML validation
for (ChangeLogParser parser : ChangeLogParserFactory.getInstance().getParsers()) {
if (parser instanceof XMLChangeLogSAXParser) {