Note: Don’t do this anymore. Use Testcontainers.
I’ve been running H2 for years as an integration testing database. I’ve finally gotten fed up with the language support inconsistencies between it and PostgreSQL. I found an easy to use, easy to configure, full featured embedded SQL server to run in my integration testing.
Add the library.
Setup the DataSource config for the default profile.
Now all your flyway scripts are fully testable and supported in local environments.
https://github.com/opentable/otj-pg-embedded
Thanks, OpenTable!