Add domain DB API

Adds DB API for creating, deleting, updating and retrieving repository
domains. No support yet for the visibility attribute switching
on retrieval. Will add that functionality after implementing
domain updates and routing into the REST API.