Database Schema¶
This page documents the database schema and entity relationships in Arctyk ITSM.
Overview¶
Arctyk ITSM uses PostgreSQL as its primary database. The schema is organized around core entities: Tickets, Projects, Assets, Users, and Comments.
Core Models¶
Ticket Model¶
The central entity in the system.
Fields:
id(PK) - Auto-incrementing integerticket_number- Unique ticket number (auto-generated)title- Ticket title (max 200 chars)description- Full description (TextField with rich text support)status- Current status (CharField, choices)status_category- Derived category (todo/in_progress/done)priority- Priority level (low/medium/high/critical)issue_type- Type (bug/task/story/epic)assignee(FK) - User assigned to ticketreporter(FK) - User who created ticketproject(FK) - Associated project- SLA Fields (new in v0.6.0):
response_target- Target response time (DateTimeField, nullable)resolution_target- Target resolution time (DateTimeField, nullable)- Lifecycle Timestamps (new in v0.6.0):
created_at- Ticket creation timestampfirst_responded_at- When first response/comment was addedresolved_at- When ticket moved to resolved statusclosed_at- When ticket was closedupdated_at- Last update timestamp
Comment Model (new in v0.6.0)¶
Support for ticket discussions with public and internal comments.
Fields:
id(PK) - Auto-incrementing integerticket(FK) - Parent ticketauthor(FK) - User who created commentcontent- Comment text (TextField with HTML/rich text support)comment_type- Type of comment (CharField: "public" or "internal")created_at- Comment creation timestampupdated_at- Last update timestampedited_at- Last edit timestamp (nullable)
Relationships:
- One-to-many with Ticket (each ticket can have many comments)
- Foreign key to User (author)
- Automatic changelog entries via signals
CommentEditHistory Model (new in v0.6.0)¶
Audit trail for comment edits.
Fields:
id(PK) - Auto-incrementing integercomment(FK) - Parent commentedited_by(FK) - User who made the editprevious_content- Content before edit (TextField)edited_at- When edit was made
Relationships:
- One-to-many with Comment
- Foreign key to User (edited_by)
Project Model¶
Organizational grouping for tickets.
Fields:
id(PK) - Auto-incrementing integername- Project name (CharField, max 255 chars)description- Project description (TextField)created_at- Creation timestampupdated_at- Last update timestamp
Asset Model¶
IT asset inventory tracking.
Fields:
id(PK) - Auto-incrementing integername- Asset name (CharField)asset_type- Type of asset (CharField)serial_number- Serial number (CharField)status- Current status (CharField)created_at- Creation timestamp
User Model¶
Extended Django User model for authentication.
Fields:
- Extends Django's default User model
- Additional profile fields through signal-based extension
is_staff- Admin access flagis_superuser- Full permissions flag
Entity Relationships¶
User (Reporter) ──────┐
│
├──> Ticket ──────> Project
│
└──> Assignee
Ticket ──────────────────> Comment
│
├──> CommentEditHistory
│
└──> Author (User)
Asset ──────────────────> (associated with Projects/Users)
Key Constraints¶
- Ticket
titleis required (NOT NULL) - Ticket
statusmust be one of predefined choices - Comment
contentis required (NOT NULL) - Comment
comment_typedefaults to "public" - All timestamp fields are auto-managed (created_at, updated_at)
- Lifecycle timestamps (first_responded_at, resolved_at, closed_at) are nullable and set by business logic
Indexes¶
Key indexes for performance:
Ticket.ticket_number(unique)Ticket.created_at(for filtering/sorting)Ticket.status(for filtering)Comment.ticket_id(for comment retrieval)Comment.created_at(for sorting)CommentEditHistory.comment_id(for edit history)