-
Notifications
You must be signed in to change notification settings - Fork 840
Flyway upgrade #3698
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
base: develop
Are you sure you want to change the base?
Flyway upgrade #3698
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR upgrades the Flyway database migration framework by removing explicit version pinning for Flyway and MariaDB JDBC driver dependencies, allowing them to be managed by Spring Boot's dependency management. The upgrade also migrates to Flyway's modular architecture with database-specific driver modules.
- Removes explicit version overrides for Flyway (7.15.0), MariaDB driver (2.7.12), and HSQLDB (2.7.4), allowing Spring Boot BOM to manage versions
- Migrates from single
flyway-coredependency to database-specific modules (flyway-database-hsqldb,flyway-mysql,flyway-database-postgresql) - Adds
permitMysqlScheme=trueconfiguration to allow MariaDB driver to connect to MySQL scheme URLs, supporting the migration to newer MariaDB driver versions
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| dependencies.gradle | Removes version overrides for Flyway, MariaDB, and HSQLDB; adds Flyway database-specific module definitions |
| server/build.gradle | Replaces flyway-core with database-specific Flyway modules; moves MariaDB driver from implementation to testImplementation |
| uaa/build.gradle | Adds MariaDB JDBC driver as runtime dependency for production use |
| server/src/main/java/org/cloudfoundry/identity/uaa/db/beans/FlywayConfiguration.java | Adds configurable Flyway clean-disabled setting with default value for production safety |
| server/src/main/java/org/cloudfoundry/identity/uaa/db/beans/DatabaseConfiguration.java | Adds MySQL scheme URL customizer for MariaDB driver compatibility; updates comments for clarity |
| server/src/test/java/org/cloudfoundry/identity/uaa/db/beans/DatabasePropertiesTest.java | Adds tests to verify database URL configuration including new permitMysqlScheme parameter |
| server/src/test/java/org/cloudfoundry/identity/uaa/db/TableAndColumnNormalizationTest.java | Updates database metadata queries to specify catalog and improves table validation logic; adds permitMysqlScheme to test URL |
| server/src/test/java/org/cloudfoundry/identity/uaa/db/DbMigrationIntegrationTestParent.java | Enables Flyway clean operation for tests by setting spring.flyway.clean-disabled=false |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
server/src/main/java/org/cloudfoundry/identity/uaa/db/beans/FlywayConfiguration.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/cloudfoundry/identity/uaa/db/TableAndColumnNormalizationTest.java
Outdated
Show resolved
Hide resolved
…to 3.5.6 These and hsqldb are now in sync with spring-boot bom.
94b1e8f to
cbb8449
Compare
To connect to jdbc:mysql: must add &permitMysqlScheme=true otherwise change to jdbc:mariadb:
- Newer Flyway versions run migrations in a transaction. - CONCURRENTLY cannot be used inside a transaction, which causes hangs - Create index without CONCURRENTLY to allow execution within a transaction - The IF NOT EXISTS clause prevents errors if the index already exists • If the migration already ran successfully (with CONCURRENTLY): • The index exists • Flyway won't re-run it (already in schema_version) • repair() updates the checksum if needed • No errors occur • If the migration hung/failed: • It's not marked as successful in schema_version • The fixed version will run • IF NOT EXISTS prevents errors if the index was partially created
cbb8449 to
6b3c8f0
Compare
Since column names are not case-sensitive in MySQL on any platform and are returned in mixed case.
5834216 to
cafd7f0
Compare
|
With the change in how flyway runs migrations in separate transactions, CONCURRENTLY was not allowed in some migrations. See 6b3c8f0 for more info. Verified that a database with the updated migrations that were already applied do not cause a problem since, we do a "baseFlyway.repair();" before the "baseFlyway.migrate();" The checksum fields will be updated on the changed migrations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Remove explicit pinning of Flyway and MariaDB drivers, which makes us in sync with the Spring Boot BOM values.
Upgrade Flyway from 7.15.0 to 11.7.2 and MariaDB drivers from 2.7.12 to 3.5.6
Add permitMysqlScheme to JDBC URL for mariadb driver
To connect to jdbc:mysql: must add &permitMysqlScheme=true
otherwise change to jdbc:mariadb:
Enable Flyway cleanDisabled configuration during tests
Handle Flyway change in transaction use
• If the migration already ran successfully (with CONCURRENTLY):
• The index exists
• Flyway won't re-run it (already in schema_version)
• repair() updates the checksum if needed
• No errors occur
• If the migration hung/failed:
• It's not marked as successful in schema_version
• The fixed version will run
• IF NOT EXISTS prevents errors if the index was partially created
Handle exception for mariadb
Use the lower_case_table_names flag on MySQL
Ignore columnNamesAreLowercase on MySQL