Available in versions: Dev (3.20) | Latest (3.19)

This is experimental functionality, and as such subject to change. Use at your own risk!

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

Data change management

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

Data change management libraries like Liquibase or Flyway are popular when working with RDBMS. In order to re-run code generation whenever a database migration has been done, consider the following configuration:

Kotlin
Groovy
jooq {
    // ...
}

tasks.named("jooqCodegen") {

    // Run code generation after Flyway migration
    dependsOn(tasks.named("flywayMigrate"))

    // Optional: Use Flyway migration scripts as input to code generation, to avoid
    // task execution when unnecessary
    inputs.files(fileTree("src/main/resources/db/migration"))
}

See the configuration XSD or the manual's various sections about code generation for more details.

jooq {
    // ...
}

tasks.named("jooqCodegen") {

    // Run code generation after Flyway migration
    dependsOn(tasks.named("flywayMigrate"))

    // Optional: Use Flyway migration scripts as input to code generation, to avoid
    // task execution when unnecessary
    inputs.files(fileTree("src/main/resources/db/migration"))
}

See the configuration XSD or the manual's various sections about code generation for more details.

By default, the gradle plugin assumes that task inputs have changed and thus it cannot participate in incremental builds (e.g. when connecting to externally managed databases). But if you manage your data changes in the same build, then we can leverage Gradle's build cache and incremental build capabilities to re-run code generation only when Flyway or Liquibase migration scripts have changed!

References to this page

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo