Schema for ticket status change audit trail.
Records every status transition for a ticket, including who made the change and an optional reason. Used for auditing and tracking ticket lifecycle.
Fields
ticket_id- Reference to the ticketchanged_by_id- User who made the status changefrom_status- Previous status (nil for initial creation)to_status- New statusreason- Optional explanation for the change
Examples
# Ticket created
%TicketStatusHistory{
ticket_id: "018e3c4a-9f6b-7890-abcd-ef1234567890",
changed_by_id: 42,
from_status: nil,
to_status: "open",
reason: nil
}
# Ticket assigned and moved to in_progress
%TicketStatusHistory{
ticket_id: "018e3c4a-9f6b-7890-abcd-ef1234567890",
changed_by_id: 5,
from_status: "open",
to_status: "in_progress",
reason: "Assigned to support team"
}
# Ticket resolved
%TicketStatusHistory{
ticket_id: "018e3c4a-9f6b-7890-abcd-ef1234567890",
changed_by_id: 5,
from_status: "in_progress",
to_status: "resolved",
reason: "Issue fixed in version 2.0.1"
}
# Ticket reopened
%TicketStatusHistory{
ticket_id: "018e3c4a-9f6b-7890-abcd-ef1234567890",
changed_by_id: 42,
from_status: "resolved",
to_status: "open",
reason: "Issue still occurring after update"
}
Summary
Functions
Changeset for creating a status history entry.
Check if this is a close transition.
Check if this is the initial creation record.
Check if this is a reopen transition.
Check if this is a resolution transition.
Types
@type t() :: %PhoenixKit.Modules.Tickets.TicketStatusHistory{ __meta__: term(), changed_by: PhoenixKit.Users.Auth.User.t() | Ecto.Association.NotLoaded.t(), changed_by_id: integer() | nil, changed_by_uuid: UUIDv7.t(), from_status: String.t() | nil, inserted_at: NaiveDateTime.t() | nil, reason: String.t() | nil, ticket: PhoenixKit.Modules.Tickets.Ticket.t() | Ecto.Association.NotLoaded.t(), ticket_id: UUIDv7.t(), to_status: String.t(), uuid: UUIDv7.t() | nil }
Functions
Changeset for creating a status history entry.
Required Fields
ticket_id- Reference to ticketchanged_by_uuid- User who made the changeto_status- New status
Note: from_status is optional (nil for ticket creation).
Check if this is a close transition.
Check if this is the initial creation record.
Check if this is a reopen transition.
Check if this is a resolution transition.