Here's my workflow:

- I have a folder of db migration scripts
- Flyway runs them all on an h2 database in Postgres mode, then dumps the 
final schema
- There's a gradle task that makes sure that the db migrations -> schema 
mapping is always up-to-date
- I'd like to slurp this schema into an h2 in Postgres mode, and use that 
to generate code with jOOQ.

The problem is, jOOQ barfs when generating code against the h2 db in 
Postgres mode.  Here's the jOOQ config:

jooq {

version = '3.9.5'

edition = 'OSS'

models(sourceSets.main) {

generator {

name = 'org.jooq.util.DefaultGenerator'

database {

driver = 'org.h2.Driver'

url = 'jdbc:h2:mem:;MODE=PostgreSQL;INIT=runscript from 
'/abs/path/init.sql'"'

schema = 'public'

}

strategy {

name = 'org.jooq.util.DefaultGeneratorStrategy'

}

database {

name = 'org.jooq.util.postgres.PostgresDatabase'

inputSchema = 'public'

}

generate {

immutablePojos = true

daos = true

}

target {

packageName = 'models.db.gen'

directory = 'src/main/jooq-generated'

}

}

}

}


And here's the error output:


04:55:47.446 [main] DEBUG org.jooq.tools.LoggerListener - Executing query  
        : select 1 as "one"

04:55:47.473 [main] DEBUG org.jooq.tools.StopWatch - Query executed         
  : Total: 34.105ms

04:55:47.605 [main] DEBUG org.jooq.tools.LoggerListener - Fetched result   
        : +----+

04:55:47.605 [main] DEBUG org.jooq.tools.LoggerListener -                  
        : | one|

04:55:47.605 [main] DEBUG org.jooq.tools.LoggerListener -                  
        : +----+

04:55:47.605 [main] DEBUG org.jooq.tools.LoggerListener -                  
        : |   1|

04:55:47.605 [main] DEBUG org.jooq.tools.LoggerListener -                  
        : +----+

04:55:47.606 [main] DEBUG org.jooq.tools.StopWatch - Finishing              
  : Total: 169.54ms, +135.435ms

04:55:47.606 [main] DEBUG org.jooq.tools.LoggerListener - Executing query  
        : select "pg_catalog"."pg_namespace"."nspname" from 
"pg_catalog"."pg_namespace"

04:55:47.608 [main] WARN org.jooq.util.AbstractDatabase - SQL exception    
        : Exception while executing meta query: Schema "pg_catalog" not 
found; SQL statement:

select "pg_catalog"."pg_namespace"."nspname" from 
"pg_catalog"."pg_namespace" [90079-196]


Any guesses for how I can trick jOOQ into generating PostgreSQL-style code 
from an h2 db in Postgres mode?


Thanks!

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to