Miscellaneous database format cleanup

More details in #6, #7, #8.

This requires re-initializing current databases. I haven't experimented yet with migrating existing data, so let's discuss and merge when we meet.