Migration
Modules to migrate the database along with the service launch.
Flyway¶
Module for database migration using the Flyway tool.
Dependency¶
Dependency build.gradle
:
Module:
Dependency build.gradle.kts
:
Module:
Requires JDBC module dependency.
Configuration¶
Example of the complete configuration described in the FlywayConfig
class (default values are specified):
Liquibase¶
Module for database migration using the Liquibase tool.
Dependency¶
Dependency build.gradle
:
Module:
Dependency build.gradle.kts
:
Module:
Requires JDBC module dependency.
Configuration¶
Example of the complete configuration described in the LiquibaseConfig
class (default values are specified):
- Path to master file migration configuration
- Path to master file migration configuration
Recommendations¶
Tip
We do not recommend using migration modules to run applications in an environment where with horizontal scaling by increasing the number of working application replicas. Since this will lead to a migration call on each replica setup. Also keep in mind that every restart of the application will also trigger migrations.
In such cases we recommend using something like Flyway Gradle plugin for local development, for tests use Flyway startup from code after database startup, for Kubernetes combat environment use K8S Job or migration from CI via Flyway Gradle plugin.