This will help to ensure our DB code stays portable, in case we need to migrate away from H2.
This looks like a big patch, but most of the changes are: