mirror of https://github.com/apache/nifi.git
NIFI-13169 Upgraded Flyway in Registry from 9.22.3 to 10.12.0
This closes #8823 Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
parent
2a45cae588
commit
08cc23826b
|
@ -296,6 +296,11 @@
|
|||
<artifactId>flyway-mysql</artifactId>
|
||||
<version>${flyway.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-database-postgresql</artifactId>
|
||||
<version>${flyway.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
|
|
|
@ -20,10 +20,10 @@ import org.flywaydb.core.api.FlywayException;
|
|||
import org.flywaydb.core.api.configuration.FluentConfiguration;
|
||||
import org.flywaydb.core.internal.database.DatabaseType;
|
||||
import org.flywaydb.core.internal.database.DatabaseTypeRegister;
|
||||
import org.flywaydb.core.internal.database.postgresql.PostgreSQLDatabaseType;
|
||||
import org.flywaydb.core.internal.jdbc.JdbcUtils;
|
||||
import org.flywaydb.database.mysql.MySQLDatabaseType;
|
||||
import org.flywaydb.database.mysql.mariadb.MariaDBDatabaseType;
|
||||
import org.flywaydb.database.postgresql.PostgreSQLDatabaseType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.flyway.FlywayConfigurationCustomizer;
|
||||
|
@ -56,7 +56,7 @@ public class CustomFlywayConfiguration implements FlywayConfigurationCustomizer
|
|||
|
||||
@Override
|
||||
public void customize(final FluentConfiguration configuration) {
|
||||
final DatabaseType databaseType = getDatabaseType(configuration.getDataSource());
|
||||
final DatabaseType databaseType = getDatabaseType(configuration.getDataSource(), configuration);
|
||||
LOGGER.info("Determined database type is {}", databaseType.getName());
|
||||
|
||||
if (databaseType instanceof MySQLDatabaseType || databaseType instanceof MariaDBDatabaseType) {
|
||||
|
@ -87,9 +87,9 @@ public class CustomFlywayConfiguration implements FlywayConfigurationCustomizer
|
|||
* @param dataSource the data source
|
||||
* @return the database type
|
||||
*/
|
||||
private DatabaseType getDatabaseType(final DataSource dataSource) {
|
||||
private DatabaseType getDatabaseType(final DataSource dataSource, final org.flywaydb.core.api.configuration.Configuration configuration) {
|
||||
try (final Connection connection = dataSource.getConnection()) {
|
||||
return DatabaseTypeRegister.getDatabaseTypeForConnection(connection);
|
||||
return DatabaseTypeRegister.getDatabaseTypeForConnection(connection, configuration);
|
||||
} catch (SQLException e) {
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
throw new FlywayException("Unable to obtain connection from Flyway DataSource", e);
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.nifi.registry.revision.api.RevisionUpdate;
|
|||
import org.apache.nifi.registry.revision.api.UpdateRevisionTask;
|
||||
import org.apache.nifi.registry.revision.standard.StandardRevisionClaim;
|
||||
import org.apache.nifi.registry.revision.standard.StandardUpdateResult;
|
||||
import org.flywaydb.core.api.configuration.FluentConfiguration;
|
||||
import org.flywaydb.core.internal.database.DatabaseType;
|
||||
import org.flywaydb.core.internal.database.DatabaseTypeRegister;
|
||||
import org.flywaydb.database.mysql.MySQLDatabaseType;
|
||||
|
@ -92,11 +93,11 @@ public class TestJdbcRevisionManager {
|
|||
|
||||
// Create the REVISION table if it does not exist
|
||||
final DataSource dataSource = jdbcTemplate.getDataSource();
|
||||
LOGGER.info("#### DataSource class is {}", new Object[]{dataSource.getClass().getCanonicalName()});
|
||||
LOGGER.info("#### DataSource class is {}", dataSource.getClass().getCanonicalName());
|
||||
|
||||
try (final Connection connection = dataSource.getConnection()) {
|
||||
final String createTableSql;
|
||||
final DatabaseType databaseType = DatabaseTypeRegister.getDatabaseTypeForConnection(connection);
|
||||
final DatabaseType databaseType = DatabaseTypeRegister.getDatabaseTypeForConnection(connection, new FluentConfiguration());
|
||||
if (databaseType.equals(new MySQLDatabaseType())) {
|
||||
createTableSql = CREATE_TABLE_SQL_MYSQL;
|
||||
} else {
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
</modules>
|
||||
<properties>
|
||||
<spring.boot.version>3.2.5</spring.boot.version>
|
||||
<flyway.version>9.22.3</flyway.version>
|
||||
<flyway.tests.version>9.5.0</flyway.tests.version>
|
||||
<flyway.version>10.12.0</flyway.version>
|
||||
<flyway.tests.version>10.0.0</flyway.tests.version>
|
||||
<swagger.ui.version>3.12.0</swagger.ui.version>
|
||||
<jgit.version>6.9.0.202403050737-r</jgit.version>
|
||||
<org.apache.sshd.version>2.12.1</org.apache.sshd.version>
|
||||
|
|
Loading…
Reference in New Issue