Refactor database setup into a separately-callable cli command