fix(backend): explicit Flyway config and DataInitializer null title fix

Adding explicit spring.flyway.* config (url/user/password) ensures Flyway
creates its own JDBC connection and runs migrations independently of the JPA
datasource initialization order in Spring Boot 4.0.

Fix DataInitializer creating a Document with title=null, which would hit the
NOT NULL constraint in the documents table once the admin user init succeeds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-19 11:08:23 +01:00
parent 9b67db74eb
commit 802f1ab0e0
2 changed files with 9 additions and 2 deletions

View File

@@ -152,9 +152,9 @@ public class DataInitializer {
.receivers(Set.of(maria))
.build());
// 5. Document with no title — tests fallback to originalFilename
// 5. Document with minimal metadata — tests sparse display
docRepo.save(Document.builder()
.title(null)
.title("Scan ohne Titel")
.originalFilename("scan_ohne_titel.pdf")
.status(DocumentStatus.UPLOADED)
.documentDate(LocalDate.of(1978, 11, 20))

View File

@@ -8,6 +8,13 @@ spring:
password: ${SPRING_DATASOURCE_PASSWORD}
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}
jpa:
hibernate:
ddl-auto: none