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.

853 B
Raw Blame
from django.db import models

from posthog.models.utils import UUIDTModel


class TicketAssignment(UUIDTModel):
    ticket = models.OneToOneField("conversations.Ticket", on_delete=models.CASCADE, related_name="assignment")
    user = models.ForeignKey("posthog.User", null=True, on_delete=models.CASCADE, related_name="+")
    role = models.ForeignKey("ee.Role", null=True, on_delete=models.CASCADE, related_name="+")
    created_at = models.DateTimeField(auto_now_add=True)

    class Meta:
        db_table = "posthog_conversations_ticket_assignment"
        constraints = [
            models.CheckConstraint(
                condition=(
                    models.Q(user__isnull=False, role__isnull=True) | models.Q(user__isnull=True, role__isnull=False)
                ),
                name="exactly_one_assignee_type",
            ),
        ]