Working template, merging to master

I've got a working template of what the DB should look like, see the small tables in /databases. Obviously we can add more invariants when we need them.