Skip to content

Add patch_id_sha column to approvals table

What does this MR do and why?

Add patch_id_sha column to eventually record the patch_id of the most-current merge_request_diff when the approval is created. We associate to patch_id rather than setting up an ActiveRecord association to a MergeRequestDiff since the approval is given against a diff, and the same diff (from a functional perspective) can be included in multiple MergeRequestDiff records (for instance, when an MR is rebased, the diff itself doesn't functionally change, but a new MergeRequestDiff record is created.) Adding this data to approvals records will help us detect when an approval is still valid, even if new MergeRequestDiffs are created.

Related to #422818 (closed)

Prior related work: !126920 (merged)

Database

Up

main: == 20230823174108 AddPatchIdShaOnApprovals: migrating =========================
main: -- add_column(:approvals, :patch_id_sha, :binary)
main:    -> 0.0013s
main: == 20230823174108 AddPatchIdShaOnApprovals: migrated (0.0060s) ================`

Down

main: == 20230823174108 AddPatchIdShaOnApprovals: reverting =========================
main: -- remove_column(:approvals, :patch_id_sha)
main:    -> 0.0015s
main: == 20230823174108 AddPatchIdShaOnApprovals: reverted (0.0049s) ================
Edited by Kerri Miller

Merge request reports

Loading