Trac Database Schema: Ticket System
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.
Table ticket
Table | Key |
ticket | id |
Columns | Type | Description |
id | auto_increment | e.g. 1 for ticket #1 |
type | Can be joined with table enum field name where field type is ticket_type
| |
time | int64 | Creation time |
changetime | int64 | Time of last modification or comment |
component | Can be joined with table component field name
| |
severity | Can be joined with table enum field name where field type is severity
| |
priority | Can be joined with table enum field name where field type is priority
| |
owner | User name or email address of ticket owner | |
reporter | User name or email address of ticket reporter | |
cc | Comma separated list of email addresses to be CC'd notifications | |
version | Can be joined with table version field name
| |
milestone | Can be joined with table milestone field name
| |
status | Ticket status e.g. new, assigned, closed | |
resolution | Can be joined with table enum field name where field type is resolution
| |
summary | Short title-like summary | |
description | Long description text | |
keywords | Comma separated list of arbitrary keywords |
Indexes |
time |
status |
Stores the current core ticket fields. Additional custom ticket field values are stored in the ticket_custom table, while the ticket history and comments are stored in the ticket_change table.
Use the trac.ticket.model.Ticket
model class to access any of these tables.
See trac.ticket.model.Ticket, TracDev/DataModels#Ticket
Table ticket_change
Table | Key |
ticket_change | ticket, time, field |
Columns | Type | Description |
ticket | int | Can be joined with table ticket field id
|
time | int64 | Time of this change or comment (group to get all related entries) |
author | Author of this change or comment | |
field | Name of the changed field | |
oldvalue | Previous value of that field | |
newvalue | New value of that field |
Indexes |
ticket |
time |
Stores ticket change history and comments.
The field value comment
is special: it associates a comment with a set of field changes. oldvalue may store the comment number in that case as an optimization.
A comment's edit history is stored in field value _comment0
, _comment1
etc. In these cases the newvalue stores the edit time.
Use the trac.ticket.model.Ticket
model class to access this table.
Table ticket_custom
Table | Key |
ticket_custom | ticket, name |
Columns | Type | Description |
ticket | int | Can be joined with table ticket field id
|
name | Custom ticket field name | |
value | Current field value |
Stores the current custom ticket field values.
Use the trac.ticket.model.Ticket
model class to access this table.
See trac.ticket.model.Ticket, TracTicketsCustomFields
Table enum
Table | Key |
enum | type, name |
Columns | Type | Description |
type | resolution, priority, ticket_type or severity | |
name | Name of the enum value | |
value | Ordering value |
Stores the different values for the various ticket enum fields.
Use the trac.ticket.model.AbstractEnum
model subclasses to access this table:
trac.ticket.model.Type
trac.ticket.model.Resolution
trac.ticket.model.Priority
trac.ticket.model.Severity
Trac initializes this table during installation with various default ticket types, resolutions and priorities.
Table component
Table | Key |
component | name |
Columns | Description |
name | Ticket component name |
owner | User name of component owner |
description | Component description |
Stores the available TicketComponent entries.
Use the trac.ticket.model.Component
model class to access this table.
Trac initializes this table during installation with some dummy components.
See trac.ticket.model.Component, TicketComponent
Table milestone
Table | Key |
milestone | name |
Columns | Type | Description |
name | Name of the milestone | |
due | int64 | Due date |
completed | int64 | Date of completion |
description | Description wiki content |
Stores the available milestones.
Use the trac.ticket.model.Milestone
model class to access this table.
Trac initializes this table during installation with some dummy milestones.
See trac.ticket.model.Milestone
Table version
Table | Key |
version | name |
Columns | Type | Description |
name | Name of the version | |
time | Release date of the version | |
description | Description wiki content |
Stores the available versions.
Use the trac.ticket.model.Version
model class to access this table.
Trac initializes this table during installation with some dummy versions.