triggersjooqjooq-codegen-maven

jOOQ code generation fails on triggers - how to skip them?


In my application I use Flyway to migrate the database. I have a SQL file containing the database structure which includes some CREATE TRIGGER statements. jOOQ code generation fails because it uses H2 which does not support triggers. What is the best way to work around this problem?

  1. Can I skip CREATE TRIGGER statements on code generation?
  2. Refactor CREATE TRIGGER statements into a separate SQL file. Can I skip SQL files based on file name for the code generation?
  3. Can I use e.g. docker to start a MariaDB server which is used instead H2 for code generation?

Or maybe you have a better or nicer idea how to deal with trigger creation?


Solution

  • You can ignore certain statements like this:

    -- [jooq ignore start]
    -- Anything between these two tokens is ignored by the jOOQ parser
    CREATE TRIGGER ...
    -- [jooq ignore stop]
    

    Find the docs here: https://www.jooq.org/doc/3.1/manual/code-generation/codegen-ddl/#N90C34