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.8 KB
Raw Blame
# Generated by Django 4.2.26 on 2025-11-18 21:16

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", "0904_alter_dashboard_creation_mode"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("ee", "0029_llmtracesummary_llmtracesummary_unique_trace_summary"),
    ]

    operations = [
        migrations.AddField(
            model_name="singlesessionsummary",
            name="distinct_id",
            field=models.CharField(
                blank=True, help_text="Distinct ID of the session's user", max_length=200, null=True
            ),
        ),
        migrations.AddField(
            model_name="singlesessionsummary",
            name="session_duration",
            field=models.IntegerField(blank=True, help_text="Session duration in seconds", null=True),
        ),
        migrations.AddField(
            model_name="singlesessionsummary",
            name="session_start_time",
            field=models.DateTimeField(blank=True, help_text="Session start time", null=True),
        ),
        migrations.CreateModel(
            name="SessionGroupSummary",
            fields=[
                ("created_at", models.DateTimeField(auto_now_add=True)),
                (
                    "id",
                    models.UUIDField(
                        default=posthog.models.utils.uuid7, editable=False, primary_key=True, serialize=False
                    ),
                ),
                (
                    "title",
                    models.CharField(
                        default="Group summary", help_text="Title of the group session summary", max_length=2048
                    ),
                ),
                (
                    "session_ids",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=200),
                        help_text="List of session replay IDs included in this group summary",
                        size=1000,
                    ),
                ),
                (
                    "summary",
                    models.JSONField(
                        help_text="Group summary in JSON format (EnrichedSessionGroupSummaryPatternsList schema)"
                    ),
                ),
                (
                    "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_group_session_summary",
                "indexes": [
                    models.Index(fields=["team", "-created_at"], name="ee_group_se_team_id_a105a8_idx"),
                    django.contrib.postgres.indexes.GinIndex(
                        fields=["title"], name="idx_group_summary_title_gin", opclasses=["gin_trgm_ops"]
                    ),
                ],
            },
        ),
    ]