Developer Moves Repository Tests from H2 to Real PostgreSQL Using Flyway
A developer building a library app discovered that their repository tests passed only against H2, an in-memory database that does not match the PostgreSQL engine used in production. The Phase 3 work moved persistence to PostgreSQL 17, with Flyway managing the schema through a baseline migration that mirrors the JPA entities and uses named constraints. Hibernate was set to validate rather than generate the schema, and database settings were moved to environment variables with setup documented in the README. Only the book copy repository test class was switched to the real database, while 45 other tests stayed on H2, and PostgreSQL runs natively since Docker was unavailable.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in