# `PhoenixKit.Migrations.Postgres.V35`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.164/lib/phoenix_kit/migrations/postgres/v35.ex#L1)

PhoenixKit V35 Migration: Support Tickets System

Adds complete customer support ticket system with status workflow,
comments with internal notes, file attachments, and audit trail.

## Changes

### Tickets Table (phoenix_kit_tickets)
- Main ticket storage with status workflow (open/in_progress/resolved/closed)
- Customer user association (who created the ticket)
- Handler assignment (support staff)
- Denormalized comment counter
- Resolved/closed timestamps for tracking

### Ticket Comments (phoenix_kit_ticket_comments)
- Threaded comments with internal notes support
- is_internal flag for staff-only visibility
- Self-referencing for nested replies

### Ticket Attachments (phoenix_kit_ticket_attachments)
- Junction table for files on tickets or comments
- Position-based ordering with captions

### Ticket Status History (phoenix_kit_ticket_status_history)
- Complete audit trail for all status changes
- Who changed, from/to status, optional reason

## Settings

- Module config: enabled, per-page
- Feature toggles: comments, internal notes, attachments
- Workflow: allow reopen

## Features

- UUIDv7 primary keys for time-sortable IDs
- Comprehensive indexes for efficient queries
- Foreign key constraints for data integrity
- Check constraint for attachment parent reference

# `down`

Rollback the V35 migration.

# `up`

Run the V34 migration to add support tickets system.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
