add foreign key information to rows