Skip to content

Preserve nested Flyway migration paths in native images#50433

Open
DragonFSKY wants to merge 1 commit into
spring-projects:mainfrom
DragonFSKY:fix/50422-flyway-native-resource-path
Open

Preserve nested Flyway migration paths in native images#50433
DragonFSKY wants to merge 1 commit into
spring-projects:mainfrom
DragonFSKY:fix/50422-flyway-native-resource-path

Conversation

@DragonFSKY
Copy link
Copy Markdown
Contributor

@DragonFSKY DragonFSKY commented May 14, 2026

NativeImageResourceProvider recursively discovers Flyway migrations in native images, but converted each discovered resource using only its filename. This flattened nested migrations such as db/migration/nested/V2__users.sql to db/migration/V2__users.sql, making the returned Flyway resource unreadable.

This change preserves the classpath-relative path from the resolver result, deriving it from the root/resource URIs for non-ClassPathResource results. The regression test forces the native-image branch and verifies that the nested migration can be read.

Closes #50422

Tests:

  • ./gradlew :module:spring-boot-flyway:check

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 14, 2026
Preserve the classpath-relative path for Flyway migrations discovered by the native image resource provider so nested migrations remain readable.

See spring-projectsgh-50422

Signed-off-by: Dongliang Xie <dragonfsky@gmail.com>
@DragonFSKY DragonFSKY force-pushed the fix/50422-flyway-native-resource-path branch from 2fff5b5 to bd0c12a Compare May 14, 2026 09:28
@DragonFSKY DragonFSKY marked this pull request as ready for review May 14, 2026 09:30
@DragonFSKY
Copy link
Copy Markdown
Contributor Author

I tried to keep the fix focused on preserving the classpath-relative resource path returned by the resolver, without changing the existing Flyway location scanning behavior. Please let me know if you would prefer a different shape for the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NativeImageResourceProvider flattens Flyway migration paths in subdirectories

2 participants