Skip to content

NativeImageResourceProvider flattens Flyway migration paths in subdirectories#50433

Merged
snicoll merged 2 commits into
spring-projects:4.0.xfrom
DragonFSKY:fix/50422-flyway-native-resource-path
Jul 16, 2026
Merged

NativeImageResourceProvider flattens Flyway migration paths in subdirectories#50433
snicoll merged 2 commits into
spring-projects:4.0.xfrom
DragonFSKY:fix/50422-flyway-native-resource-path

Conversation

@DragonFSKY

@DragonFSKY DragonFSKY commented May 14, 2026

Copy link
Copy Markdown
Contributor

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
@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.

@snicoll snicoll changed the title Preserve nested Flyway migration paths in native images NativeImageResourceProvider flattens Flyway migration paths in subdirectories Jul 16, 2026
@snicoll snicoll added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 16, 2026
@snicoll snicoll self-assigned this Jul 16, 2026
@snicoll snicoll added this to the 4.0.8 milestone Jul 16, 2026
@snicoll
snicoll force-pushed the fix/50422-flyway-native-resource-path branch from bd0c12a to 8948f3c Compare July 16, 2026 13:24
@snicoll
snicoll changed the base branch from main to 4.0.x July 16, 2026 13:24
DragonFSKY and others added 2 commits July 16, 2026 15:38
This commit preserves the classpath-relative path for Flyway migration
discovered by the native image resource provider so nested migrations
remain readable.

See spring-projectsgh-50433

Signed-off-by: Dongliang Xie <dragonfsky@gmail.com>
@snicoll
snicoll force-pushed the fix/50422-flyway-native-resource-path branch from 8948f3c to 9f8f4da Compare July 16, 2026 13:38
@snicoll
snicoll merged commit 21cb821 into spring-projects:4.0.x Jul 16, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NativeImageResourceProvider flattens Flyway migration paths in subdirectories

3 participants