Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Support for H2 embedded Java database #73

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Support for H2 embedded Java database #73

wants to merge 3 commits into from

Conversation

spodkowinski
Copy link
Contributor

This PR will add support for H2 as another database option. As H2 supports a Postgres combat mode, only minor changes were needed when it comes to SQL and JDBC handling.

Using H2, reaper can be distributed as a self contained package (except for yaml config) without having to rely on the in-memory store. Database files will be created automatically using the schema in the new reaper_h2.sql file.

@varjoranta
Copy link
Contributor

I like the idea of using H2, but I'm not totally sure about the current proposed implementation. I will ponder a bit on this, and think what would happen if a third database implementation was added.

@spodkowinski
Copy link
Contributor Author

TBH my first plan was to add MySQL or H2 support by implementing the IStorage API. However, that would require to refactor out some common classes out of the postgres package that could be used in new implementations as well. The alternative would be to just duplicate the postgres implemenation and fix all incompatibilities which would result in a lot of duplicated code.
It would be great if the storage API JDBI integration could be made more DB agnostic. But the effort should be considerable.
Given the postgres compatibility, introducing h2 into the project using the existing postgres storage implementation was a better option that could be done much quicker. In case at some point adding new storage implementations would be easier, I'd be happy to adapt the h2 code for that as well. Until then I think the h2 option lowers barriers and might help people to make up their minds to give the project a test drive.

@varjoranta
Copy link
Contributor

To me it feels like just adding more database implementations doesn't really serve an acute user need, unless it brings in more capabilities for the system. H2 implementation does bring the ease of use in case you don't want to separately maintain a separate database instance. Adding MySQL in addition to Postgres doesn't seem to add anything else except complexity into the code. Thus I'm starting to lean into having a bit custom, as long as it is short and simple as possible, implementation for the H2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants