db as optional dependency