Skip to main content

jEAP Spring Boot DB Migration Starter

jEAP Spring Boot DB Migration Starter is a Spring Boot starter that runs Flyway database migrations in jEAP services with a PostgreSQL focus. On Kubernetes-based platforms it lets the schema migration run as a dedicated job (init container) that completes before the application pods start, so the database is ready before the service goes live. For local development it falls back to the familiar migrate-on-startup behaviour. Adding the starter and a few properties is enough — it auto-configures a custom Flyway migration strategy. It provides:

  • A custom FlywayMigrationStrategy that picks the right behaviour for the current platform
  • Init-container mode: migrate, then terminate the pod with the migration result as exit code
  • Application-container mode: verify the migration was already applied, otherwise refuse to start
  • Startup-migrate mode: classic migrate-on-startup, used automatically outside Kubernetes
  • Configuration via the database-migration.* properties, on top of the standard spring.flyway.* properties

Documentation

Start with Getting started, then follow the links below.

TopicFile
Getting started (add the dependency, configure)docs/getting-started.md
Migration modes & strategy resolutiondocs/migration-modes.md
Configuration reference (database-migration.*)docs/configuration.md
Kubernetes deployment & the migration jobdocs/kubernetes-deployment.md

Modules

Group id for all modules is ch.admin.bit.jeap; the version is managed by the jEAP Spring Boot parent. Consumers depend on jeap-spring-boot-db-migration-starter.

ModulePurpose
jeap-spring-boot-db-migration-starterThe starter: Flyway auto-configuration and the platform migration strategy
jeap-spring-boot-db-migration-starter-itIntegration tests against a PostgreSQL Testcontainer