Persisted changeset history
Created by: eseliger
Introduces a new column on the changeset, which stores the history. It can only change if the changeset events change, and as we already have that at hand in SetDerivedState, storing it will make it so we never need to calculate it again until we receive a webhook notification or sync the changeset. For existing changesets, I've added a migration that runs in the background in repo-updater which can be removed after the following release. For the history, given that we walk it in ascending order of time, we also missed an opportunity to start iterating over the history only from the point in time where we stopped searching the last time we looked for an event. Additionally, I've added a store method which can retrieve only the histories, because it's way faster than fetching all columns.
With these improvements, I was able to get compute time for my local 9k changesets campaign down from ~5.4s to ~280ms. That will be the foundation for a follow-up PR that increases the granularity of the burndown chart, which seemed infeasible before, because it easily took 15-20s.
Closes https://github.com/sourcegraph/sourcegraph/issues/15398 Works towards https://github.com/sourcegraph/sourcegraph/issues/15034
This is still missing some tests, but I'd like a first eye before adding them so I don't waste the time if the approach seems odd to someone.