Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

3.3 KB
Raw Blame
# Generated by Django 4.2.26 on 2025-12-18 20:03

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models

import posthog.models.utils


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ("posthog", "0956_team_conversations_enabled_and_more"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Ticket",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=posthog.models.utils.UUIDT, editable=False, primary_key=True, serialize=False
                    ),
                ),
                (
                    "channel_source",
                    models.CharField(
                        choices=[("widget", "Widget"), ("email", "Email"), ("slack", "Slack")],
                        default="widget",
                        max_length=20,
                    ),
                ),
                ("widget_session_id", models.CharField(db_index=True, max_length=64)),
                ("distinct_id", models.CharField(max_length=400)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("new", "New"),
                            ("open", "Open"),
                            ("pending", "Pending"),
                            ("on_hold", "On hold"),
                            ("resolved", "Resolved"),
                        ],
                        default="new",
                        max_length=20,
                    ),
                ),
                (
                    "priority",
                    models.CharField(
                        blank=True,
                        choices=[("low", "Low"), ("medium", "Medium"), ("high", "High")],
                        max_length=20,
                        null=True,
                    ),
                ),
                ("anonymous_traits", models.JSONField(blank=True, default=dict)),
                ("ai_resolved", models.BooleanField(default=False)),
                ("escalation_reason", models.TextField(blank=True, null=True)),
                ("unread_customer_count", models.IntegerField(default=0)),
                ("unread_team_count", models.IntegerField(default=0)),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "assigned_to",
                    models.ForeignKey(
                        blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL
                    ),
                ),
                ("team", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="posthog.team")),
            ],
            options={
                "db_table": "posthog_conversations_ticket",
                "indexes": [
                    models.Index(fields=["team", "widget_session_id"], name="posthog_con_team_id_cf3e51_idx"),
                    models.Index(fields=["team", "distinct_id"], name="posthog_con_team_id_943139_idx"),
                    models.Index(fields=["team", "status"], name="posthog_con_team_id_a21425_idx"),
                ],
            },
        ),
    ]