Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Liquibase to 4.14.0 and resolve most deprecation warnings #26977

Merged
merged 1 commit into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
<jboss-logmanager.version>1.0.10</jboss-logmanager.version>
<flyway.version>8.5.13</flyway.version>
<yasson.version>1.0.11</yasson.version>
<liquibase.version>4.13.0</liquibase.version>
<liquibase.version>4.14.0</liquibase.version>
<snakeyaml.version>1.30</snakeyaml.version>
<osgi.version>6.0.0</osgi.version>
<mongo-client.version>4.6.1</mongo-client.version>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/liquibase-mongodb.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ YAML, JSON and XML formats are supported for the changeLog.
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">

<changeSet id="1" author="loic">
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/liquibase.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ The yaml, json, xml and sql changeLog file formats are also supported.
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
http://www.liquibase.org/xml/ns/dbchangelog
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<changeSet author="quarkus" id="1">
<createTable tableName="quarkus">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.IOException;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
Expand Down Expand Up @@ -96,11 +97,12 @@ void nativeImageConfiguration(
liquibase.database.jvm.JdbcConnection.class.getName()));

reflective.produce(new ReflectiveClassBuildItem(true, true, true,
liquibase.parser.ChangeLogParserCofiguration.class.getName(),
liquibase.parser.ChangeLogParserConfiguration.class.getName(),
liquibase.hub.HubServiceFactory.class.getName(),
liquibase.logging.core.DefaultLoggerConfiguration.class.getName(),
// deprecated, but still used by liquibase.nosql.lockservice.AbstractNoSqlLockService
liquibase.configuration.GlobalConfiguration.class.getName(),
com.datical.liquibase.ext.config.LiquibaseProConfiguration.class.getName(),
liquibase.GlobalConfiguration.class.getName(),
liquibase.license.LicenseServiceFactory.class.getName(),
liquibase.executor.ExecutorService.class.getName(),
liquibase.change.ChangeFactory.class.getName(),
Expand Down Expand Up @@ -136,7 +138,6 @@ void nativeImageConfiguration(

Stream.of(liquibase.change.Change.class,
liquibase.changelog.ChangeLogHistoryService.class,
liquibase.command.LiquibaseCommand.class,
liquibase.database.Database.class,
liquibase.database.DatabaseConnection.class,
liquibase.datatype.LiquibaseDataType.class,
Expand All @@ -163,6 +164,10 @@ void nativeImageConfiguration(
// Register Precondition services, and the implementation class for reflection while also registering fields for reflection
addService(services, reflective, liquibase.precondition.Precondition.class, true);

// CommandStep implementations are needed (just like in non-mongodb variant)
addService(services, reflective, liquibase.command.CommandStep.class, false,
"liquibase.command.core.StartH2CommandStep");

// liquibase XSD
resource.produce(new NativeImageResourceBuildItem(
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.7.xsd",
Expand All @@ -172,14 +177,9 @@ void nativeImageConfiguration(
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.11.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.12.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.13.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.14.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd",
"www.liquibase.org/xml/ns/pro/liquibase-pro-4.7.xsd",
"www.liquibase.org/xml/ns/pro/liquibase-pro-4.8.xsd",
"www.liquibase.org/xml/ns/pro/liquibase-pro-4.9.xsd",
"www.liquibase.org/xml/ns/pro/liquibase-pro-4.10.xsd",
"www.liquibase.org/xml/ns/pro/liquibase-pro-4.11.xsd",
"www.liquibase.org/xml/ns/pro/liquibase-pro-4.12.xsd",
"www.liquibase.org/xml/ns/pro/liquibase-pro-4.13.xsd",
"liquibase.build.properties"));

// liquibase resource bundles
Expand All @@ -188,11 +188,15 @@ void nativeImageConfiguration(

private void addService(BuildProducer<ServiceProviderBuildItem> services,
BuildProducer<ReflectiveClassBuildItem> reflective, Class<?> serviceClass,
boolean shouldRegisterFieldForReflection) {
boolean shouldRegisterFieldForReflection, String... excludedImpls) {
try {
String service = "META-INF/services/" + serviceClass.getName();
Set<String> implementations = ServiceUtil.classNamesNamedIn(Thread.currentThread().getContextClassLoader(),
service);
if (excludedImpls.length > 0) {
implementations = new HashSet<>(implementations);
implementations.removeAll(Arrays.asList(excludedImpls));
}
services.produce(new ServiceProviderBuildItem(serviceClass.getName(), implementations.toArray(new String[0])));

reflective.produce(new ReflectiveClassBuildItem(true, true, shouldRegisterFieldForReflection,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.quarkus.liquibase.deployment;

import static io.quarkus.deployment.annotations.ExecutionTime.STATIC_INIT;
import static java.util.function.Predicate.not;

import java.io.IOException;
import java.nio.file.Paths;
Expand Down Expand Up @@ -119,11 +120,10 @@ void nativeImageConfiguration(
liquibase.command.CommandFactory.class.getName()));

reflective.produce(new ReflectiveClassBuildItem(true, true, true,
liquibase.parser.ChangeLogParserCofiguration.class.getName(),
liquibase.parser.ChangeLogParserConfiguration.class.getName(),
liquibase.hub.HubServiceFactory.class.getName(),
liquibase.logging.core.DefaultLoggerConfiguration.class.getName(),
liquibase.configuration.GlobalConfiguration.class.getName(),
com.datical.liquibase.ext.config.LiquibaseProConfiguration.class.getName(),
liquibase.GlobalConfiguration.class.getName(),
liquibase.license.LicenseServiceFactory.class.getName(),
liquibase.executor.ExecutorService.class.getName(),
liquibase.change.ChangeFactory.class.getName(),
Expand Down Expand Up @@ -154,15 +154,14 @@ void nativeImageConfiguration(
new ReflectiveClassBuildItem(true, true, true, classesMarkedWithDatabaseChangeProperty.toArray(new String[0])));

Collection<String> dataSourceNames = jdbcDataSourceBuildItems.stream()
.map(i -> i.getName())
.map(JdbcDataSourceBuildItem::getName)
.collect(Collectors.toSet());

resource.produce(
new NativeImageResourceBuildItem(getChangeLogs(dataSourceNames, liquibaseBuildConfig).toArray(new String[0])));

Stream.of(liquibase.change.Change.class,
liquibase.changelog.ChangeLogHistoryService.class,
liquibase.command.LiquibaseCommand.class,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is deprecated, hence also this change: https://github.com/quarkusio/quarkus/pull/26977/files#diff-930f0d68c059b4088f05d8c3d7a725e110279966c77958a6d699f9c652bde81eL48-R47

It was added back in #9636, but I don't see how the following is still the case today:

This capability is also shown in our Liquibase quickstart

liquibase.database.Database.class,
liquibase.database.DatabaseConnection.class,
liquibase.datatype.LiquibaseDataType.class,
Expand Down Expand Up @@ -198,9 +197,12 @@ void nativeImageConfiguration(

// CommandStep implementations are needed
consumeService(liquibase.command.CommandStep.class, (serviceClass, implementations) -> {
services.produce(new ServiceProviderBuildItem(serviceClass.getName(), implementations.toArray(new String[0])));
reflective.produce(new ReflectiveClassBuildItem(true, false, false, implementations.toArray(new String[0])));
for (String implementation : implementations) {
var filteredImpls = implementations.stream()
.filter(not("liquibase.command.core.StartH2CommandStep"::equals))
.toArray(String[]::new);
services.produce(new ServiceProviderBuildItem(serviceClass.getName(), filteredImpls));
reflective.produce(new ReflectiveClassBuildItem(true, false, false, filteredImpls));
for (String implementation : filteredImpls) {
runtimeInitialized.produce(new RuntimeInitializedClassBuildItem(implementation));
}
});
Expand All @@ -214,14 +216,9 @@ void nativeImageConfiguration(
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.11.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.12.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.13.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.14.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd",
famod marked this conversation as resolved.
Show resolved Hide resolved
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd",
"www.liquibase.org/xml/ns/pro/liquibase-pro-4.7.xsd",
"www.liquibase.org/xml/ns/pro/liquibase-pro-4.8.xsd",
"www.liquibase.org/xml/ns/pro/liquibase-pro-4.9.xsd",
"www.liquibase.org/xml/ns/pro/liquibase-pro-4.10.xsd",
"www.liquibase.org/xml/ns/pro/liquibase-pro-4.11.xsd",
"www.liquibase.org/xml/ns/pro/liquibase-pro-4.12.xsd",
"www.liquibase.org/xml/ns/pro/liquibase-pro-4.13.xsd",
"liquibase.build.properties"));

// liquibase resource bundles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

import io.quarkus.liquibase.runtime.LiquibaseConfig;
import io.quarkus.liquibase.runtime.LiquibaseDataSourceBuildTimeConfig;
import liquibase.configuration.GlobalConfiguration;
import liquibase.configuration.LiquibaseConfiguration;
import liquibase.GlobalConfiguration;

/**
* This fixture provides access to read the expected and the actual configuration of liquibase.
Expand Down Expand Up @@ -51,15 +50,16 @@ public void assertDefaultConfigurationSettings(LiquibaseConfig configuration) {

assertEquals(configuration.changeLog, LiquibaseDataSourceBuildTimeConfig.defaultConfig().changeLog);

GlobalConfiguration globalConfiguration = LiquibaseConfiguration.getInstance()
.getConfiguration(GlobalConfiguration.class);
assertEquals(configuration.databaseChangeLogTableName,
globalConfiguration.getDatabaseChangeLogTableName());
GlobalConfiguration.DATABASECHANGELOG_TABLE_NAME.getCurrentValue());
assertEquals(configuration.databaseChangeLogLockTableName,
globalConfiguration.getDatabaseChangeLogLockTableName());
assertEquals(configuration.liquibaseTablespaceName.orElse(null), globalConfiguration.getLiquibaseTablespaceName());
assertEquals(configuration.liquibaseCatalogName.orElse(null), globalConfiguration.getLiquibaseCatalogName());
assertEquals(configuration.liquibaseSchemaName.orElse(null), globalConfiguration.getLiquibaseSchemaName());
GlobalConfiguration.DATABASECHANGELOGLOCK_TABLE_NAME.getCurrentValue());
assertEquals(configuration.liquibaseTablespaceName.orElse(null),
GlobalConfiguration.LIQUIBASE_TABLESPACE_NAME.getCurrentValue());
assertEquals(configuration.liquibaseCatalogName.orElse(null),
GlobalConfiguration.LIQUIBASE_CATALOG_NAME.getCurrentValue());
assertEquals(configuration.liquibaseSchemaName.orElse(null),
GlobalConfiguration.LIQUIBASE_SCHEMA_NAME.getCurrentValue());

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
http://www.liquibase.org/xml/ns/dbchangelog
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<includeAll path="db/all/test" errorIfMissingOrEmpty="true"/>
</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<property name="table.prefix" value="TBL_"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">


</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">


</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<include relativeToChangelogFile="true" file="create-tables.xml" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<changeSet author="dev (generated)" id="create-tables-1">
<createTable tableName="LIQUIBASE">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<changeSet author="dev (generated)" id="create-view-1">
<createView viewName="LIQUIBASE_VIEW">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<changeSet author="dev (generated)" id="test-1">
<createTable tableName="TEST">
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">

<changeSet id="1" author="loic">
Expand Down