: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(mcp): make MCPSession backfill columns nullable (#60041)
Georgis Andonis7be53e0bc5eb
diff --git a/products/mcp_analytics/backend/migrations/0005_alter_mcpsession_duration_seconds_and_more.py b/products/mcp_analytics/backend/migrations/0005_alter_mcpsession_duration_seconds_and_more.pynew file mode 100644index 000000000000..30e5fb082e5d--- /dev/null+++ b/products/mcp_analytics/backend/migrations/0005_alter_mcpsession_duration_seconds_and_more.py@@ -0,0 +1,27 @@+# Generated by Django 5.2.14 on 2026-05-26 10:15++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("mcp_analytics", "0004_mcpintentclustersnapshot"),+ ]++ operations = [+ migrations.AlterField(+ model_name="mcpsession",+ name="duration_seconds",+ field=models.IntegerField(blank=True, null=True),+ ),+ migrations.AlterField(+ model_name="mcpsession",+ name="session_end",+ field=models.DateTimeField(blank=True, null=True),+ ),+ migrations.AlterField(+ model_name="mcpsession",+ name="session_start",+ field=models.DateTimeField(blank=True, null=True),+ ),+ ]diff --git a/products/mcp_analytics/backend/migrations/max_migration.txt b/products/mcp_analytics/backend/migrations/max_migration.txtindex 94ca7122ec1f..42dd8ed1f2bc 100644--- a/products/mcp_analytics/backend/migrations/max_migration.txt+++ b/products/mcp_analytics/backend/migrations/max_migration.txt@@ -1 +1 @@-0004_mcpintentclustersnapshot+0005_alter_mcpsession_duration_seconds_and_morediff --git a/products/mcp_analytics/backend/models.py b/products/mcp_analytics/backend/models.pyindex c42ac391687e..dfd1979c5b4f 100644--- a/products/mcp_analytics/backend/models.py+++ b/products/mcp_analytics/backend/models.py@@ -81,9 +81,9 @@ class MCPSession(UUIDModel, TeamScopedRootMixin):team = models.ForeignKey("posthog.Team", on_delete=models.CASCADE)session_id = models.CharField(max_length=64)- session_start = models.DateTimeField()- session_end = models.DateTimeField()- duration_seconds = models.IntegerField()+ session_start = models.DateTimeField(null=True, blank=True)+ session_end = models.DateTimeField(null=True, blank=True)+ duration_seconds = models.IntegerField(null=True, blank=True)tools_used = ArrayField(models.CharField(max_length=200), default=list, blank=True)tool_call_count = models.IntegerField(default=0)