Skip to content
AITroveRead. Build. Understand.
Make this comfortable

Spring Boot project: test a versioned receipt schema before choosing deployment ownership

Last updated: 30 Sept 20264 min read
tutorial
IntermediateBy AITrove Editorial

A versioned receipt project should prove schema transitions before promoting a database-backed API.

Download Spring source kit

Assemble the local check

The source kit already has three migration files and a non-web Boot startup fixture. Run V2, insert an old-shape receipt, then run V3 against the same named H2 database. Check history, backfilled rows, old-writer rejection and new-writer acceptance. Run a separate checksum-mismatch test to confirm startup fails rather than serving against uncertain schema state.

This is a project boundary, not a deployed receipt service. ReceiptApplication still uses an in-memory ReceiptStore and fixture Basic authentication. The test starter and SQL resources are not runtime migration wiring. The earlier API project describes that runnable surface; the test-scope lesson marks what remains separate.

Choose the next release gate

Decide whether an application instance or a deployment job owns migrations. Use a disposable instance of the selected production database, not H2 alone. Start actual old and new application versions across V2; measure DDL locks and verify rollback options. Backfill tenant ownership from an authoritative source before enforcing NOT NULL.

Only after those checks should the API use a persistent repository and make readiness depend on its required database. A passing migration test does not provide a real identity store, broker or durable outbox worker. Keep each boundary named in the deployment plan.

Checked source

bash
mvn -q -Dtest=BootFlywayStartupTest,FlywayReceiptMigrationTest test

Verification boundary

BootFlywayStartupTest and FlywayReceiptMigrationTest. The excerpt is shortened; the source kit contains the checked fixture.

Costs and limits

The deliverable is a local checked source kit. There is no production database, migration job, runtime Flyway wiring, real issuer, broker or release orchestration.

Common Mistakes

  • Do not present the non-web test context as the runnable API.
  • Do not apply V3 before retiring old writers.
  • Do not treat a green migration test as proof of crash recovery.

Read next

Spring Boot Flyway startup: apply versioned SQL before querying a receipt, Spring Boot migration tests: distinguish a test starter from a runtime rollout, Spring Boot receipt API project: build, test and inspect the limits, Spring Boot tenant command API project: assemble the local write path.

spring
spring-boot
configuration
Storage details