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.

2.3 KB
Raw Blame
# Generated by Django 4.2.29 on 2026-03-23 11:28

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

import posthog.utils
import posthog.models.utils


class Migration(migrations.Migration):
    dependencies = [
        ("posthog", "1056_migrate_experiments_models"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("logs", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="LogsView",
            fields=[
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True, null=True)),
                (
                    "id",
                    models.UUIDField(
                        default=posthog.models.utils.uuid7,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "short_id",
                    models.CharField(
                        blank=True,
                        default=posthog.utils.generate_short_id,
                        max_length=12,
                    ),
                ),
                ("name", models.CharField(max_length=400)),
                ("filters", models.JSONField(default=dict)),
                ("pinned", models.BooleanField(default=False)),
                (
                    "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": "logs_logsview",
                "indexes": [
                    models.Index(
                        fields=["team_id", "-created_at"],
                        name="logs_view_team_created_idx",
                    )
                ],
                "unique_together": {("team", "short_id")},
            },
        ),
    ]