/squash-db-migrations

Example project demonstrating how to squash DB migrations using Testcontainers

Primary LanguageJavaMIT LicenseMIT

Squashing DB migrations using Testcontainers

This project illustrates the approach described in my article, which allows squashing (compacting) database migrations into a single file using Testcontainers. This can result in a reduced test execution time in certain cases.

The example project uses:

Yet, the approach should look rather similar with different framework and databases.

Building sources

The project uses Maven as its build tool, so it's enough to run:

./mvnw clean verify

Familiarizing with the code

I recommend reading the article before digging into the code.

There are three classes that could be used as a good entry points:

Database migrations can be found within the db.migration directory.

The output of squashing procedure is stored within the init.sql file.