https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/17042 follow up - Migrate old issue records with `closed_by_id` information
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/17042 adds a closed_by_id
column into issues
and expose it on the issues API. Although this value will mostly be used for newer records (issues closed after getting it shipped), it'd be great to get old records consistent.
Proposal
We're currently able to fetch the author
from events
table on Event::CLOSED
events (when closing issues):
project.events.where(target_id: issue.id, target_type: "Issue", action: Event::CLOSED).last.author
So we should be able to create a long-running background migration to update issues.closed_by_id
in batches. Since it'll be iterating over issues
and using the events
table, we might also want to update issues.closed_at
.