fixes #8588 - make repo indexing idempotent

This makes sure we don't touch the associations unless there's been a change, and it adds time stamps so that new items can be calculated for mail notifications in #4780