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.

chore(insights): drop obsolete posthog_insightcachingstate table (#71280)

Thomas Obermüller2009b6646243
diff --git a/products/product_analytics/backend/migrations/0003_drop_insightcachingstate_table.py b/products/product_analytics/backend/migrations/0003_drop_insightcachingstate_table.py
new file mode 100644
index 000000000000..789f829fa9bd
--- /dev/null
+++ b/products/product_analytics/backend/migrations/0003_drop_insightcachingstate_table.py
@@ -0,0 +1,20 @@
+# Drops the posthog_insightcachingstate table. The model was removed from Django state in
+# 0002_delete_insightcachingstate (#70453, deployed 2026-07-14), which kept the table alive
+# for one deploy cycle so in-flight old pods could keep writing. That window has long passed:
+# nothing reads or writes the table, and the surviving FK on dashboard_tile_id was the last
+# thing making DashboardTile hard-deletes fail. Dropping the table removes it for good.
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("product_analytics", "0002_delete_insightcachingstate"),
+ ]
+
+ operations = [
+ migrations.RunSQL(
+ sql="DROP TABLE IF EXISTS posthog_insightcachingstate;",
+ reverse_sql=migrations.RunSQL.noop, # obsolete table, no reverse
+ ),
+ ]
diff --git a/products/product_analytics/backend/migrations/max_migration.txt b/products/product_analytics/backend/migrations/max_migration.txt
index 58643ce65672..07eb16c39477 100644
--- a/products/product_analytics/backend/migrations/max_migration.txt
+++ b/products/product_analytics/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0002_delete_insightcachingstate
+0003_drop_insightcachingstate_table