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.

5.5 KB
Raw Blame
# Generated by Django 4.2.22 on 2025-08-01 19:16

import uuid

import django.utils.timezone
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ("posthog", "0815_sharingconfiguration_settings"),
    ]

    operations = [
        migrations.CreateModel(
            name="Task",
            fields=[
                ("id", models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ("title", models.CharField(max_length=255)),
                ("description", models.TextField()),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("backlog", "Backlog"),
                            ("todo", "To Do"),
                            ("in_progress", "In Progress"),
                            ("testing", "Testing"),
                            ("done", "Done"),
                        ],
                        default="backlog",
                        max_length=20,
                    ),
                ),
                (
                    "origin_product",
                    models.CharField(
                        choices=[
                            ("error_tracking", "Error Tracking"),
                            ("eval_clusters", "Eval Clusters"),
                            ("user_created", "User Created"),
                            ("support_queue", "Support Queue"),
                            ("session_summaries", "Session Summaries"),
                        ],
                        max_length=20,
                    ),
                ),
                ("position", models.IntegerField(default=0)),
                (
                    "repository_config",
                    models.JSONField(
                        default=dict, help_text="Repository configuration with organization and repository fields"
                    ),
                ),
                (
                    "github_branch",
                    models.CharField(blank=True, help_text="Branch created for this task", max_length=255, null=True),
                ),
                ("github_pr_url", models.URLField(blank=True, help_text="Pull request URL when created", null=True)),
                ("created_at", models.DateTimeField(default=django.utils.timezone.now)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "github_integration",
                    models.ForeignKey(
                        blank=True,
                        help_text="GitHub integration for this task",
                        limit_choices_to={"kind": "github"},
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="posthog.integration",
                    ),
                ),
                ("team", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="posthog.team")),
            ],
            options={
                "db_table": "posthog_task",
                "ordering": ["position"],
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="TaskProgress",
            fields=[
                ("id", models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("started", "Started"),
                            ("in_progress", "In Progress"),
                            ("completed", "Completed"),
                            ("failed", "Failed"),
                        ],
                        default="started",
                        max_length=20,
                    ),
                ),
                ("current_step", models.CharField(blank=True, help_text="Current step being executed", max_length=255)),
                ("total_steps", models.IntegerField(default=0, help_text="Total number of steps if known")),
                ("completed_steps", models.IntegerField(default=0, help_text="Number of completed steps")),
                ("output_log", models.TextField(blank=True, help_text="Live output from Claude Code execution")),
                ("error_message", models.TextField(blank=True, help_text="Error message if execution failed")),
                ("workflow_id", models.CharField(blank=True, help_text="Temporal workflow ID", max_length=255)),
                ("workflow_run_id", models.CharField(blank=True, help_text="Temporal workflow run ID", max_length=255)),
                ("activity_id", models.CharField(blank=True, help_text="Temporal activity ID", max_length=255)),
                ("created_at", models.DateTimeField(default=django.utils.timezone.now)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("completed_at", models.DateTimeField(blank=True, null=True)),
                (
                    "task",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, related_name="progress_logs", to="tasks.task"
                    ),
                ),
                ("team", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="posthog.team")),
            ],
            options={
                "db_table": "posthog_task_progress",
                "ordering": ["-created_at"],
            },
        ),
    ]