PhoenixKit.Migrations.Postgres.V35 (phoenix_kit v1.7.71)

Copy Markdown View Source

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

Summary

Functions

Rollback the V35 migration.

Run the V34 migration to add support tickets system.

Functions

down(opts)

Rollback the V35 migration.

up(opts)

Run the V34 migration to add support tickets system.