Kora фреймворк для написания Java / Kotlin приложений с упором на производительность, эффективность, прозрачность сделанный разработчиками Т-Банк / Тинькофф

Kora is a framework for writing Java / Kotlin applications with a focus on performance, efficiency, transparency made by T-Bank / Tinkoff developers

Skip to content

Migration

Modules to migrate the database along with the service launch.

Flyway

Module for database migration using the Flyway tool.

Dependency

Dependency build.gradle:

implementation "ru.tinkoff.kora:database-flyway"

Module:

@KoraApp
public interface Application extends FlywayJdbcDatabaseModule { }

Dependency build.gradle.kts:

implementation("ru.tinkoff.kora:database-flyway")

Module:

@KoraApp
interface Application : FlywayJdbcDatabaseModule

Requires JDBC module dependency.

Configuration

Example of the complete configuration described in the FlywayConfig class (default values are specified):

flyway {
    locations = "db/migration" //(1)!
}
  1. Directory paths where to look for migration scripts
flyway:
  locations: "db/migration" #(1)!
  1. Directory paths where to look for migration scripts

Liquibase

Module for database migration using the Liquibase tool.

Dependency

Dependency build.gradle:

implementation "ru.tinkoff.kora:database-liquibase"

Module:

@KoraApp
public interface Application extends LiquibaseJdbcDatabaseModule { }

Dependency build.gradle.kts:

implementation("ru.tinkoff.kora:database-liquibase")

Module:

@KoraApp
interface Application : LiquibaseJdbcDatabaseModule

Requires JDBC module dependency.

Configuration

Example of the complete configuration described in the LiquibaseConfig class (default values are specified):

liquibase {
    changelog = "db/changelog/db.changelog-master.xml" //(1)!
}
  1. Path to master file migration configuration
liquibase:
  changelog: "db/changelog/db.changelog-master.xml" #(1)!
  1. 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.