DB api refactoring

This change does not create anything new.

The db api file was growing too large, so now it is a module with
separate files corresponding to each db model.

Change-Id: I4e032536d5389606d6edd7c0eb80c58ccc159447
Fix 009 migration

We should not have two 009 migrations

Change-Id: I023cd9613b784dcfc54a484070f0dda6443ce31a