I would like to find a reliable way to test my Maria DB schema with Jooq. This is what I have now:
org.jooq.codegen.XMLGenerator
, this step will generate a maria_information_schema.xml
;To test all the classes I will write I have develop a technique:
InitDatabase.java
class which manually set a DB schema as similar as possible with the MariaDB one;This procedure works perfectly as far as I don't change something on the real DB and I forgot to do the same on the InitDatabase.java
class.
My question is: is there a way to use the XML schema or the generated java classes to create an H2 Database with the same schema as the MariaDb one without writing manually all the create table statement?
Thanks
This is an open ended question with no obvious, "correct" answer. jOOQ's official take here is that you may want to re-consider using alternative RDBMS for testing what you could be doing with your target RDBMS directly, specifically using testcontainers.
You could combine this approach with jOOQ's code generation for a more streamlined development process.
In short, jOOQ's recommendation is to use:
Other, equivalent products are obviously also possible.