I’m having trouble coming up with a solution for the following issue.
Lets say i have a db that looks something like the following:
Issue Table
Id | Details | CreateDate | ClosedDate
Issue Notes Table
Id | ObjectId | Notes | NoteDate
Issue Assignment Table
Id | ObjectId | AssignedToId| AssignedDate
I’d like allow the linking of an issue to another issue.
I thought about adding a column to the Issue table called ParentIssueId and that would allow me the ability to link issues, but i foresee circular references occurring within the issue table if i go through with this implementation.
Is there a better way to go about doing this, and if so, how?
Thanks
Create a table:
the PK will keep some duplicates away, but create a check constraint:
IssueIDa<IssueIDbso you don’t end up with a duplicate like:however to prevent a circle like:
you’ll need a trigger that resolves the chain, and fails on a circle. Using a recursive CTE would be your best bet to detect this circle.