Setup database relations properly