dev.monosoul.jooq.migration.BuiltInMigrationRunner.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jooq-gradle-plugin Show documentation
Show all versions of jooq-gradle-plugin Show documentation
Generates jOOQ classes using dockerized database
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