Backfill merge_requests.merged_commit_sha
### Problem to solve In https://gitlab.com/gitlab-org/gitlab/-/merge_requests/129311, we added a new column `merged_commit_sha` to `merge_requests` that keeps track of the SHA that got merged, regardless of the merge method. Once backfilled, we can simplify the implementation of the `#merged_commit_sha` method (simplicity), and reduce the `UNION`s in [`.by_related_commit_sha`](https://gitlab.com/gitlab-org/gitlab/-/blob/ff19a9d6a4b6e86bf64fc16520ecfcc1043e41e2/app/models/merge_request.rb#L333) (performance). ### Proposal Backfill the column with the value of `MergeRequest#merged_commit_sha` as it was implemented prior to the addition of the explicit column: ```ruby def merged_commit_sha return unless merged? sha = merge_commit_sha || squash_commit_sha || diff_head_sha sha.presence end ```
issue