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.0 KB
Raw Blame
# Generated by Django 4.2.22 on 2025-08-29 14:42

import django.db.models.deletion
import django.contrib.postgres.fields
import django.contrib.postgres.indexes
from django.conf import settings
from django.db import migrations, models

import posthog.models.utils


class Migration(migrations.Migration):
    dependencies = [
        ("posthog", "0833_experiment_primary_metrics_ordered_uuids_and_more"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("ee", "0026_conversation_created_at_conversation_title_and_more"),
    ]

    operations = [
        migrations.CreateModel(
            name="SingleSessionSummary",
            fields=[
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "id",
                    models.UUIDField(
                        default=posthog.models.utils.uuid7, editable=False, primary_key=True, serialize=False
                    ),
                ),
                ("session_id", models.CharField(help_text="Session replay ID", max_length=200)),
                (
                    "summary",
                    models.JSONField(help_text="Session summary in JSON format (SessionSummarySerializer schema)"),
                ),
                (
                    "exception_event_ids",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=200),
                        blank=True,
                        default=list,
                        help_text="List of event IDs where exceptions occurred for searchability",
                        size=100,
                    ),
                ),
                (
                    "extra_summary_context",
                    models.JSONField(
                        blank=True,
                        help_text="Additional context passed to the summary (ExtraSummaryContext schema)",
                        null=True,
                    ),
                ),
                (
                    "run_metadata",
                    models.JSONField(
                        blank=True, help_text="Summary run metadata (SessionSummaryRunMeta schema)", null=True
                    ),
                ),
                (
                    "created_by",
                    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": "ee_single_session_summary",
                "indexes": [
                    models.Index(fields=["team", "session_id"], name="ee_single_s_team_id_5e726a_idx"),
                    django.contrib.postgres.indexes.GinIndex(
                        fields=["exception_event_ids"], name="idx_exception_event_ids_gin"
                    ),
                ],
            },
        ),
    ]