| 1 | [[PageOutline(2)]] |
| 2 | |
| 3 | = Trac Database Schema: Ticket System |
| 4 | |
| 5 | Trac ticket system uses various database tables to store the tickets themselves, the change history and comments, and the various configurable ticket field enums etc. |
| 6 | |
| 7 | == Table `ticket` |
| 8 | ||'''Table'''||'''Key'''|| |
| 9 | ||''ticket''||''id''|| |
| 10 | |
| 11 | ||'''Columns'''||'''Type'''||'''Description'''|| |
| 12 | ||''id''||`auto_increment`||e.g. 1 for ticket #1|| |
| 13 | ||''type''|| ||Can be joined with [#Tableenum table enum] field `name` where field `type` is ''ticket_type''|| |
| 14 | ||''time''||`int64`||Creation time|| |
| 15 | ||''changetime''||`int64`||Time of last modification or comment|| |
| 16 | ||''component''|| ||Can be joined with [#Tablecomponent table component] field `name`|| |
| 17 | ||''severity''|| ||Can be joined with [#Tableenum table enum] field `name` where field `type` is ''severity''|| |
| 18 | ||''priority''|| ||Can be joined with [#Tableenum table enum] field `name` where field `type` is ''priority''|| |
| 19 | ||''owner''|| ||User name or email address of ticket owner|| |
| 20 | ||''reporter''|| ||User name or email address of ticket reporter|| |
| 21 | ||''cc''|| ||Comma separated list of email addresses to be CC'd notifications|| |
| 22 | ||''version''|| ||Can be joined with [#Tableversion table version] field `name`|| |
| 23 | ||''milestone''|| ||Can be joined with [#Tablemilestone table milestone] field `name`|| |
| 24 | ||''status''|| ||Ticket status e.g. ''new'' or ''fixed''|| |
| 25 | ||''resolution''|| ||Can be joined with [#Tableenum table enum] field `name` where field `type` is ''resolution''|| |
| 26 | ||''summary''|| ||Short title-like summary|| |
| 27 | ||''description''|| ||Long description text|| |
| 28 | ||''keywords''|| ||Comma separated list of arbitrary keywords|| |
| 29 | |
| 30 | ||''Indexes''|| |
| 31 | ||''time''|| |
| 32 | ||''status''|| |
| 33 | |
| 34 | Stores the current core ticket fields. Additional custom ticket field values are stored in the [#Tableticket_custom ticket_custom] table, while the ticket history and comments are stored in the [#Tableticket_change ticket_change] table. |
| 35 | |
| 36 | Use the `trac.ticket.model.Ticket` model class to access any of these tables. |
| 37 | |
| 38 | See [browser:trunk/trac/ticket/model.py trac.ticket.model.Ticket], TracDev/DataModels#Ticket |
| 39 | |
| 40 | |
| 41 | == Table `ticket_change` |
| 42 | ||'''Table'''||'''Key'''|| |
| 43 | ||''ticket_change''||''ticket'', ''time'', ''field''|| |
| 44 | |
| 45 | ||'''Columns'''||'''Type'''||'''Description'''|| |
| 46 | ||''ticket''||`int`||Can be joined with [#Tableticket table ticket] field `id`|| |
| 47 | ||''time''||`int64`||Time of this change or comment (group to get all related entries)|| |
| 48 | ||''author''|| ||Author of this change or comment|| |
| 49 | ||''field''|| ||Name of the changed field|| |
| 50 | ||''oldvalue''||Previous value of that field|| |
| 51 | ||''newvalue''||New value of that field|| |
| 52 | |
| 53 | ||''Indexes''|| |
| 54 | ||''ticket''|| |
| 55 | ||''time''|| |
| 56 | |
| 57 | Stores ticket change history and comments. |
| 58 | |
| 59 | Use the `trac.ticket.model.Ticket` model class to access this table. |
| 60 | |
| 61 | See [browser:trunk/trac/ticket/model.py trac.ticket.model.Ticket] |
| 62 | |
| 63 | == Table `ticket_custom` |
| 64 | ||'''Table'''||'''Key'''|| |
| 65 | ||''ticket_custom''||''ticket'', ''name''|| |
| 66 | |
| 67 | ||'''Columns'''||'''Type'''||'''Description'''|| |
| 68 | ||''ticket''||`int`||Can be joined with [#Tableticket table ticket] field `id`|| |
| 69 | ||''name''|| ||Custom ticket field name|| |
| 70 | ||''value''|| ||Current field value|| |
| 71 | |
| 72 | Stores the current custom ticket field values. |
| 73 | |
| 74 | Use the `trac.ticket.model.Ticket` model class to access this table. |
| 75 | |
| 76 | See [browser:trunk/trac/ticket/model.py trac.ticket.model.Ticket], TracTicketsCustomFields |
| 77 | |
| 78 | == Table `enum` |
| 79 | ||'''Table'''||'''Key'''|| |
| 80 | ||''enum''||''type'', ''name''|| |
| 81 | |
| 82 | ||'''Columns'''||'''Type'''||'''Description'''|| |
| 83 | ||''type''|| ||''resolution'', ''priority'', ''ticket_type'' or ''severity''|| |
| 84 | ||''name''|| ||Name of the enum value|| |
| 85 | ||''value''|| ||Ordering value|| |
| 86 | |
| 87 | Stores the different values for the various ticket enum fields. |
| 88 | |
| 89 | Use the `trac.ticket.model.AbstractEnum` model subclasses to access this table: |
| 90 | * `trac.ticket.model.Type` |
| 91 | * `trac.ticket.model.Resolution` |
| 92 | * `trac.ticket.model.Priority` |
| 93 | * `trac.ticket.model.Severity` |
| 94 | |
| 95 | Trac initializes this table during installation with various default ticket types, resolutions and priorities. |
| 96 | |
| 97 | See [browser:trunk/trac/ticket/model.py trac.ticket.model] |
| 98 | |
| 99 | == Table `component` |
| 100 | ||'''Table'''||'''Key'''|| |
| 101 | ||''component''||''name''|| |
| 102 | |
| 103 | ||'''Columns'''||'''Description'''|| |
| 104 | ||''name''||Ticket component name|| |
| 105 | ||''owner''||User name of component owner|| |
| 106 | ||''description''||Component description|| |
| 107 | |
| 108 | Stores the available TicketComponent entries. |
| 109 | |
| 110 | Use the `trac.ticket.model.Component` model class to access this table. |
| 111 | |
| 112 | Trac initializes this table during installation with some dummy components. |
| 113 | |
| 114 | See [browser:trunk/trac/ticket/model.py trac.ticket.model.Component], TicketComponent |
| 115 | |
| 116 | == Table `milestone` |
| 117 | ||'''Table'''||'''Key'''|| |
| 118 | ||''milestone''||''name''|| |
| 119 | |
| 120 | ||'''Columns'''||'''Type'''||'''Description'''|| |
| 121 | ||''name''|| ||Name of the milestone|| |
| 122 | ||''due''||`int64`||Due date|| |
| 123 | ||''completed''||`int64`||Date of completion|| |
| 124 | ||''description''|| ||Description wiki content|| |
| 125 | |
| 126 | Stores the available milestones. |
| 127 | |
| 128 | Use the `trac.ticket.model.Milestone` model class to access this table. |
| 129 | |
| 130 | Trac initializes this table during installation with some dummy milestones. |
| 131 | |
| 132 | See [browser:trunk/trac/ticket/model.py trac.ticket.model.Milestone] |
| 133 | |
| 134 | == Table `version` |
| 135 | ||'''Table'''||'''Key'''|| |
| 136 | ||''version''||''name''|| |
| 137 | |
| 138 | ||'''Columns'''||'''Type'''||'''Description'''|| |
| 139 | ||''name''|| ||Name of the version|| |
| 140 | ||''time''|| ||Release date of the version|| |
| 141 | ||''description''|| ||Description wiki content|| |
| 142 | |
| 143 | Stores the available versions. |
| 144 | |
| 145 | Use the `trac.ticket.model.Version` model class to access this table. |
| 146 | |
| 147 | Trac initializes this table during installation with some dummy versions. |
| 148 | |
| 149 | See [browser:trunk/trac/ticket/model.py trac.ticket.model.Version] |