fix(ontology): use correct FK for HAS_LATEST_DIFF edge
[skip schema-version-check]
What does this MR do and why?
HAS_LATEST_DIFF was joining on the wrong FK. The edge definition used fk_column: merge_request_id, which is the same join HAS_DIFF uses and returns all diffs for an MR. The correct FK is latest_merge_request_diff_id on gl_merge_request, which points to only the most recent diff.
- Before:
JOIN ON mr.id = diff.merge_request_id(all diffs) - After:
JOIN ON diff.id = mr.latest_merge_request_diff_id(latest diff only)
Closes #603 (closed)
Testing
Ontology validation passes. Verified compiled SQL output with orbit compile, the generated join now uses the correct FK.
Performance Analysis
- This merge request does not introduce any performance regression. If a performance regression is expected, explain why.
Edited by Jean-Gabriel Doyon