title: Use JOOQ to create a database for testing
body: <p>Firstly JOOQ is fantastic and has saved me more time than I care to mention.  Recently I've been looking at testing with JOOQ and there is a great MockResult and associated classes for mocking results from the DB.  But of course one challenge of testing DB layers is at some point you have to know if the queries actually work.</p>
  
  <p>As JOOQ, when generating classes, is effectively taking a snapshot of your DB why can we not use that to recreate the DB for testing?  For example spin up an in memory DB and run a createDatabase() or getTableSql() type command.  So my question is does anyone know of a way this can be achieved with JOOQ?</p>
  
  <p>With such a setup JOOQ could impart it's knowledge of the DB structure, albeit minus indices and other niceties, and then the queries can be tested.  Sure I have db deployment scripts around but this would allow a purely java based solution.  After all if the DB changes you need to regenerate JOOQ anyway so why not work from that snapshot.</p>
  
  <p>As an aside to this I already have a checkDatabase() command which runs on application start that cycles through JOOQ tables and fields to verify they all exist and throws an exception if the environment in which the application is being deployed does not match the last JOOQ snapshot which was taken.</p>