Repair `repo_statistics`/`gitserver_repos_statistics` in migration
Created by: mrnugget
Yesterday @eseliger and I noticed that the gitserver_repos_statistics
table contained negative values, which Should Not Be Possible
After spending the whole afternoon yesterday reading through every line of the involved database triggers and tables again, we finally realized that the code is correct, but the original migration that setup the database had the wrong order of things.
What this does is to reset both statistics tables -- repo_statistics
and gitserver_repos_statistics
-- to restore proper counts.
REVIEWERS: See the comments in the up.sql
for more details.
Test plan
- We already ran the code in these migrations on dot-com and confirmed that afterwards the counts are correct again.
- We are now monitoring dot-com to make sure the counts don't drift again.
- On Monday, after a full weekend of syncing/deleting/cloning repos I'm going to check that the counts still are correct and then I'll merge this.