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.

fix(file-system): drop the retired desktop folder tables (#122447)

Eli Reisman44e074e15f36
diff --git a/posthog/migrations/1412_drop_retired_desktop_file_system_tables.py b/posthog/migrations/1412_drop_retired_desktop_file_system_tables.py
new file mode 100644
index 000000000000..fe531b121d9c
--- /dev/null
+++ b/posthog/migrations/1412_drop_retired_desktop_file_system_tables.py
@@ -0,0 +1,27 @@
+from django.db import migrations
+
+from posthog.migration_helpers import SafeDropTable
+
+
+class Migration(migrations.Migration):
+ """Drop the desktop file-system tables 1285 left behind.
+
+ 1285 took FileSystemFolderInstructions and FileSystemFolderContextGeneration out of Django state and
+ kept their tables, with their foreign keys to posthog_team, posthog_user and posthog_filesystem.
+ The keys are DEFERRABLE INITIALLY DEFERRED, and Django no longer cascades into these tables, so
+ deleting a team, a user or a folder that a row references fails at COMMIT, and the team deletion
+ workflow retries until it gives up.
+
+ canvas.0003_migrate_desktop_tree copies these rows into the canvas and tasks models, so a database
+ that has not run it yet must run it before the tables go. Databases created from the squashed
+ history never had these tables, and SafeDropTable skips a table that does not exist.
+ """
+
+ dependencies = [
+ ("posthog", "1411_personalapikey_expires_at"),
+ ("canvas", "0003_migrate_desktop_tree"),
+ ]
+
+ operations = [
+ SafeDropTable(["posthog_filesystemfolderinstructions", "posthog_filesystemfoldercontextgeneration"]),
+ ]
diff --git a/posthog/migrations/max_migration.txt b/posthog/migrations/max_migration.txt
index a02049f1e561..9ef40db59f0b 100644
--- a/posthog/migrations/max_migration.txt
+++ b/posthog/migrations/max_migration.txt
@@ -1 +1 @@
-1411_personalapikey_expires_at
+1412_drop_retired_desktop_file_system_tables