Fixes #7247 - Add migration and rake task to correct corrupted cached counters