Abstract out db.setup

This sets up the connection if it is not already defined.

Signed-off-by: Byron Ruth <b@devel.io>