WIP: Adapt to new couchdb schema
see lhcb-core/nightly-builds/lb-nightly-db!2 (merged), lhcb-core/nightly-builds/lb-nightly-db!4 (merged) and let's not forget the comments in !53 (closed).
Not to be merged, otherwise we may break the production instance.
Edited by Marco Clemencic