From 68a68474961f84712f7a857e149932be671ca8fc Mon Sep 17 00:00:00 2001 From: Robbie Coomber Date: Tue, 29 Oct 2024 12:54:18 +0000 Subject: [PATCH] Add migration to drop and recreate the mv --- .../0083_recreate_sessions_v1_after_limiting_teams.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 posthog/clickhouse/migrations/0083_recreate_sessions_v1_after_limiting_teams.py diff --git a/posthog/clickhouse/migrations/0083_recreate_sessions_v1_after_limiting_teams.py b/posthog/clickhouse/migrations/0083_recreate_sessions_v1_after_limiting_teams.py new file mode 100644 index 0000000000000..d0da2eb158b6d --- /dev/null +++ b/posthog/clickhouse/migrations/0083_recreate_sessions_v1_after_limiting_teams.py @@ -0,0 +1,8 @@ +from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions +from posthog.models.sessions.sql import DROP_SESSION_MATERIALIZED_VIEW_SQL, SESSIONS_TABLE_MV_SQL + +operations = [ + # drop the mv, and recreate it with the new part of the WHERE clause + run_sql_with_exceptions(DROP_SESSION_MATERIALIZED_VIEW_SQL()), + run_sql_with_exceptions(SESSIONS_TABLE_MV_SQL()), +]