Upgrade liquibase to version 4.25.1

Closes #26570

Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
This commit is contained in:
Stefan Guilhen 2024-02-02 12:18:52 -03:00 committed by Alexander Schwartz
parent ac6f16df70
commit fbeba83b87
3 changed files with 7 additions and 4 deletions

View file

@ -19,6 +19,8 @@ package org.keycloak.connections.jpa.updater.liquibase.conn;
import liquibase.Liquibase; import liquibase.Liquibase;
import liquibase.Scope; import liquibase.Scope;
import liquibase.ScopeManager;
import liquibase.ThreadLocalScopeManager;
import liquibase.database.AbstractJdbcDatabase; import liquibase.database.AbstractJdbcDatabase;
import liquibase.database.Database; import liquibase.database.Database;
import liquibase.database.DatabaseFactory; import liquibase.database.DatabaseFactory;
@ -72,6 +74,7 @@ public class DefaultLiquibaseConnectionProvider implements LiquibaseConnectionPr
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
try { try {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
Scope.setScopeManager(new ThreadLocalScopeManager());
Scope.getCurrentScope(); Scope.getCurrentScope();
} finally { } finally {
Thread.currentThread().setContextClassLoader(currentClassLoader); Thread.currentThread().setContextClassLoader(currentClassLoader);

View file

@ -60,8 +60,8 @@ public class CustomLockService extends StandardLockService {
private static final Logger log = Logger.getLogger(CustomLockService.class); private static final Logger log = Logger.getLogger(CustomLockService.class);
@Override @Override
protected boolean hasDatabaseChangeLogLockTable() throws DatabaseException { protected boolean isDatabaseChangeLogLockTableCreated() throws DatabaseException {
boolean originalReturnValue = super.hasDatabaseChangeLogLockTable(); boolean originalReturnValue = super.isDatabaseChangeLogLockTableCreated();
if (originalReturnValue && database.getConnection().getDatabaseProductName().equals("H2")) { if (originalReturnValue && database.getConnection().getDatabaseProductName().equals("H2")) {
/* Liquibase only checks that the table exists. On the H2 database, creation of a table with a primary key is not atomic, /* Liquibase only checks that the table exists. On the H2 database, creation of a table with a primary key is not atomic,
and the primary key might not be visible yet. The primary key would be needed to prevent inserting the data into the table and the primary key might not be visible yet. The primary key would be needed to prevent inserting the data into the table
@ -98,7 +98,7 @@ public class CustomLockService extends StandardLockService {
public void init() throws DatabaseException { public void init() throws DatabaseException {
Executor executor = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor(LiquibaseConstants.JDBC_EXECUTOR, database); Executor executor = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor(LiquibaseConstants.JDBC_EXECUTOR, database);
if (!hasDatabaseChangeLogLockTable()) { if (!isDatabaseChangeLogLockTableCreated()) {
try { try {
if (log.isTraceEnabled()) { if (log.isTraceEnabled()) {

View file

@ -147,7 +147,7 @@
<freemarker.version>2.3.32</freemarker.version> <freemarker.version>2.3.32</freemarker.version>
<jetty9.version>${jetty94.version}</jetty9.version> <jetty9.version>${jetty94.version}</jetty9.version>
<liquibase.version>4.23.2</liquibase.version> <liquibase.version>4.25.1</liquibase.version>
<osgi.version>4.2.0</osgi.version> <osgi.version>4.2.0</osgi.version>
<pax.web.version>7.1.0</pax.web.version> <pax.web.version>7.1.0</pax.web.version>
<servlet.api.30.version>1.0.2.Final</servlet.api.30.version> <servlet.api.30.version>1.0.2.Final</servlet.api.30.version>