Adds issue_id and merge_request_id columns to duo_workflows_workflows table
What does this MR do and why?
This MR partially addresses #570291 by adding a polymorphic noteable association to the duo_workflows_workflows table.
Edit: following our database guidelines, the direction of this MR has changed to use a foreign keys approach to add the issue_id and merge_request_id columns to the duo_workflows_workflows table instead of the previous polymorphic associations approach.
Context:
This is the first of three MRs split from a larger change (see original MR). The split makes it easier to review and enables iterative delivery.
Problem:
In the original MR, Duo Workflows identifies associated work items (issues, merge requests) by parsing URLs from the workflow goal text using regex patterns. This approach is fragile, it fails with multiple references, doesn't handle goal text changes, and poses potential security risks with permissive patterns.
Solution:
We are adding issue_id and merge_request_id columns to the duo_workflows_workflows table, allowing direct database relationships between workflows and their associated work items. This provides:
- Type safe access to associated entities
- Persistence across goal text changes
- Better query performance (indexed foreign keys vs. regex parsing)
- Foundation for supporting multiple noteable types (Issues, MergeRequests, Epics, etc.)
MR Sequence:
-
MR 1: Add
issue_idandmerge_request_idcolumns to theduo_workflows_workflowstable <- you are here - MR 2: Implement agent service for system notes
- MR 3: Integrate agent service with work items UI (upcoming)
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.