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 6.1.2 on 2026-10-30 12:47

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

import posthog.uuidt


class Migration(migrations.Migration):
    dependencies = [
        ("posthog", "1415_organizationaiterms"),
        ("signals", "0222_signalreport_team_updated_idx"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="PersonalInboxRanking",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=posthog.uuidt.uuid7,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("input_hash", models.CharField(max_length=64)),
                ("candidate_ids", models.JSONField(default=list)),
                ("result", models.JSONField(default=dict)),
                ("personalized", models.BooleanField(default=False)),
                (
                    "activity_summary_version",
                    models.PositiveIntegerField(blank=True, null=True),
                ),
                ("model", models.CharField(max_length=100)),
                ("prompt_version", models.PositiveSmallIntegerField()),
                ("tokens_in", models.IntegerField(blank=True, null=True)),
                ("tokens_out", models.IntegerField(blank=True, null=True)),
                ("latency_ms", models.IntegerField(blank=True, null=True)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("ok", "Ok"),
                            ("fallback", "Fallback"),
                            ("empty", "Empty"),
                        ],
                        max_length=20,
                    ),
                ),
                (
                    "fallback_reason",
                    models.CharField(blank=True, max_length=100, null=True),
                ),
                (
                    "team",
                    models.ForeignKey(
                        db_constraint=False,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="posthog.team",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        db_constraint=False,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "default_manager_name": "all_teams",
                "indexes": [
                    models.Index(
                        fields=["team", "user", "-created_at"],
                        name="signals_personal_rank_latest",
                    )
                ],
            },
            managers=[
                ("all_teams", django.db.models.manager.Manager()),
            ],
        ),
    ]