Make DB promise-based to avoid race conditions