Resolve "Store the number of merge request commits in merge_request_diffs.commits_count"
What does this MR do?
Stores the number of commits in merge_request_diffs table.
Are there points in the code the reviewer needs to double check?
- background migration was tested only on local small DB. This change may be potentially dangerous if an existing migration creates MergeRequestDiff ActiveRecord's object (in such case the migration would fails because commits_count attribute wouldn't be in DB yet). I didn't find such migration except an existing migration test (where commits_count access is stubbed now). Tested only on local DB including rollbacks 3 months back.
- commits_count is set only when creating a MergeRequestDiff supposing that there is no other place where commits could be created. If it's possible to create or destroy MergeRequestDiffCommit independently, an extra before_create and before_destroy callbacks on MergeRequestDiffCommit would be needed
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Tests added for this feature/bug - Review
-
Has been reviewed by Backend -
Has been reviewed by Database
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Squashed related commits together
What are the relevant issue numbers?
Closes #38068 (closed)
Edited by Yorick Peterse