Proposed Changes to Ticket Data Model

tickets

ticket_idticket_attrib_idsequencevalue
111Fix Blah Blah in X Module
121We really should fix Blah Blah in the X Module because it affects Y and Z as well as P, D, and Q. I can recreate it by doing so-and-so.
1311 (Component 1)
1412 (Version 2.0)
1514 (Normal)
1151Yeah, I see the problem...
1152Fixed in [1]

ticket_attribs

ticket_attrib_idticket_attrib_namelabelAllowMultiple?AllowWiki?UI_Widget
1SummaryShort SummaryNNtext
2DescriptionFull DescriptionNYtextbox
3ComponentComponentYNselect
4VersionVersionYNselect
5SeveritySeverityNNselect
6PriorityPriorityNNselect
7MilestoneTarget MilestoneNNselect
8KeywordsKeywordsNNtext
9AssignedTo?Assigned ToNNtext
10CCCCYNtext
11StatusStatusNNtext
12ResolutionResolutionNNtext
13ReportedBy?Reported ByNNtext
14ReportedDate?DateNNtext
15CommentCommentYYtextbox

ticket_attrib_values

ticket_attrib_idticket_attrib_value_idticket_attrib_value
31Component 1
32Component 2
41Version 1.0
42Version 2.0
43Version 3.0
51Blocker
52Critical
53Major
54Normal
55Minor
56Trivial
57Enhancement

ticket_changes

ticket_idtimeauthorticket_attrib_idoldvaluenewvalue
11061788261brad312

The only real modification to the ticket_changes table is to rename field to ticket_attrib_id.

Notes

  • I haven't thought about attributes that have modifiers themselves yet.
    • Milestones have dates and descriptions
    • Comments have dates and authors

Pros

  • Standard Ticket Attributes and Custom Ticket Attributes are handled in same way
    • no different handlers in code
    • no need for trac.ini section for custom ticket attributes
  • All attributes and attribute values have surrogate keys, so changes to the values themselves don't orphan any 'no-longer-valid' values.
  • This format, coupled with metadata allows for simpler code to deal with the data model, most likely reduced lines of code, and table-driven extensions of the system that are implemented without any code changes or recompiles, etc.
  • A very interesting feature of allowing multiple value, i.e. this bug is exhibited in multiple versions, or, for our company, I'd love to know that there are multiple customers (a custom field for us) interested in this ticket. See Trac ticket #918

Cons

  • The vertical structure of a ticket, and handling multi-row results for doing work with a ticket is unorthodox, but I believe, and am hoping, this could be handled in some sort of Python data structure.
  • The tables do not self-describe very well, and developers are reliant on metadata to figure out how to relate and use tables. i.e. you can't tell much about a ticket in the tickets table from the table's field names
  • You'll need an extra translation step to take human-readable queries and turn them into attribute ids. People will still want to write code and do administration referring to the field names.
  • There's a performance hit for doing sql queries with constraints on multiple columns, such as "select * from tickets where owner='joe' and priority<2 and status='Open'" because you're doing self-joins on the table.