: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(tasks): drop redundant team_id index on sandbox session ledger (#116751)
posthog[bot]67627ef90563
diff --git a/products/tasks/backend/migrations/0140_drop_sandbox_session_team_index.py b/products/tasks/backend/migrations/0140_drop_sandbox_session_team_index.pynew file mode 100644index 000000000000..1873443aba13--- /dev/null+++ b/products/tasks/backend/migrations/0140_drop_sandbox_session_team_index.py@@ -0,0 +1,15 @@+from django.db import migrations++from posthog.migration_helpers import DropFieldIndexesConcurrently+++class Migration(migrations.Migration):+ atomic = False++ dependencies = [+ ("tasks", "0139_remove_loop_models"),+ ]++ operations = [+ DropFieldIndexesConcurrently(model_name="sandboxsession", name="team"),+ ]diff --git a/products/tasks/backend/migrations/max_migration.txt b/products/tasks/backend/migrations/max_migration.txtindex 798d8c1cb894..0b84cfa50db7 100644--- a/products/tasks/backend/migrations/max_migration.txt+++ b/products/tasks/backend/migrations/max_migration.txt@@ -1 +1 @@-0139_remove_loop_models+0140_drop_sandbox_session_team_indexdiff --git a/products/tasks/backend/models.py b/products/tasks/backend/models.pyindex 20a01eb6b612..26fe5fdc1ab5 100644--- a/products/tasks/backend/models.py+++ b/products/tasks/backend/models.py@@ -3548,7 +3548,10 @@ class SandboxSession(TeamScopedRootMixin, UUIDModel):# db_constraint=False on the team FK: adding an FK constraint to that hot table# locks it and stalls deploys; Django still enforces the relation and on_delete at# the app level (see safe-django-migrations.md).- team = models.ForeignKey("posthog.Team", on_delete=models.CASCADE, related_name="+", db_constraint=False)+ # db_index=False: sandbox_session_team_attr_idx leads with team_id and serves every team filter.+ team = models.ForeignKey(+ "posthog.Team", on_delete=models.CASCADE, related_name="+", db_constraint=False, db_index=False+ )task_run = models.ForeignKey("tasks.TaskRun", on_delete=models.CASCADE, related_name="sandbox_sessions")sandbox_id = models.CharField(max_length=255, unique=True, help_text="Provider sandbox id (e.g. Modal object id)")