Move db to component instead of global