Skip to content

Instantly share code, notes, and snippets.

@whyoleg
Last active November 4, 2019 06:20
Show Gist options
  • Save whyoleg/63195b60eb85e8fe2114b30f28b892ef to your computer and use it in GitHub Desktop.
Save whyoleg/63195b60eb85e8fe2114b30f28b892ef to your computer and use it in GitHub Desktop.
JOOQ with flyway and gradle
import com.opentable.db.postgres.embedded.*
import org.flywaydb.core.*
import org.jooq.codegen.*
tasks.named("compileKotlin") {
doFirst {
//create embedded postgresql
EmbeddedPostgres.builder().setPort(5400).start().use {
//migrate embedded posrtgresql
Flyway.configure()
.locations("filesystem:$projectDir/migrations/")
.schemas("public")
.dataSource(it.postgresDatabase)
.load()
.migrate()
//generate jooq classes
GenerationTool.generate("some xml for jooq")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment