database package (not finished, now to staging instead of 0.3)

Compare with #533 for the original PR. This PR is not meant to be merged as quickly as possible. Instead, I would like to get some feedback and maybe you get some useful ideas for features I could implement in the future while reading the code. My plans for the next weeks can be read in the PR #533 and haven't changed until now.