fix(backend): explicit Flyway bean to bypass broken auto-configuration

Spring Boot 4.0 Flyway auto-configuration is not triggering in the CI
environment — confirmed by empty DB and no flyway_schema_history table.
Replace YAML-based auto-config with an explicit @Bean that creates and
runs Flyway directly on startup, independent of any auto-configuration
conditions. Disable the auto-config via spring.flyway.enabled=false to
prevent interference. Add @DependsOn("flyway") to DataInitializer to
enforce that CommandLineRunner beans are only registered after migrations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-18 20:34:41 +01:00
parent e6db43850b
commit a60905674f
3 changed files with 32 additions and 5 deletions

View File

@@ -9,11 +9,7 @@ spring:
driver-class-name: org.postgresql.Driver
flyway:
enabled: true
locations: classpath:db/migration
url: ${SPRING_DATASOURCE_URL}
user: ${SPRING_DATASOURCE_USERNAME}
password: ${SPRING_DATASOURCE_PASSWORD}
enabled: false # Managed explicitly via FlywayConfig bean
jpa:
hibernate: