Unify all the db setup/teardown code
Add pendings for prepared queries