Create a table joining commit SHAs to MRs
We currently serialise the commits present in an MR version in the merge_request_diffs.st_commits
column. This is fine for storing and rendering the commit objects for a single MR, but makes it hard to find:
- Which MRs have a commit present now.
- Which MRs had a commit in the past.
- What the previous commits in an MR were. (We have some kind of workaround for this: https://gitlab.com/gitlab-org/gitlab-ce/blob/v9.0.0/app/models/merge_request.rb#L824-834.)
If we had a table joining commits to MRs, or MR diffs, then we could query on it, which would help with:
- https://gitlab.com/gitlab-org/gitlab-ce/issues/2383 - Add link on commit page to merge request that introduced that commit
- https://gitlab.com/gitlab-org/gitlab-ce/issues/28982 - Add Merge request (MR) link in a pipeline email
- https://gitlab.com/gitlab-org/gitlab-ce/issues/29939 - ETag caching for merge request notes polling
- https://gitlab.com/gitlab-org/gitlab-ce/issues/24323 - Don't lose commit-related comments on rebase