change db to promise