All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.monosoul.jooq.migration.BuiltInMigrationRunner.kt Maven / Gradle / Ivy

The newest version!
package dev.monosoul.jooq.migration

import dev.monosoul.jooq.settings.DatabaseCredentials
import org.flywaydb.core.Flyway

internal class BuiltInMigrationRunner(
    codegenAwareClassLoader: ClassLoader,
) : MigrationRunner {
    private val flyway = Flyway.configure(codegenAwareClassLoader)

    override fun migrateDb(
        schemas: Array,
        migrationLocations: Array,
        flywayProperties: Map,
        credentials: DatabaseCredentials,
        defaultFlywaySchema: String,
        flywayTable: String,
    ) = flyway
        .dataSource(credentials.jdbcUrl, credentials.username, credentials.password)
        .schemas(*schemas)
        .locations(*migrationLocations)
        .defaultSchema(defaultFlywaySchema)
        .table(flywayTable)
        .configuration(flywayProperties)
        .load()
        .migrate()
        .targetSchemaVersion
        .let { SchemaVersion(it ?: "null") }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy