-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add migration to add web vitals LCP to sessions v2
- Loading branch information
Showing
4 changed files
with
398 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions | ||
from posthog.models.raw_sessions.migrations import ( | ||
WRITABLE_RAW_SESSIONS_ADD_VITALS_LCP_COLUMN_SQL, | ||
DISTRIBUTED_RAW_SESSIONS_ADD_VITALS_LCP_COLUMN_SQL, | ||
BASE_RAW_SESSIONS_ADD_VITALS_LCP_COLUMN_SQL, | ||
) | ||
from posthog.models.raw_sessions.sql import ( | ||
DROP_RAW_SESSION_MATERIALIZED_VIEW_SQL, | ||
RAW_SESSIONS_TABLE_MV_SQL, | ||
RAW_SESSIONS_VIEW_SQL, | ||
) | ||
|
||
operations = [ | ||
# drop the mv, so we are no longer receiving events from the sessions table | ||
run_sql_with_exceptions(DROP_RAW_SESSION_MATERIALIZED_VIEW_SQL()), | ||
# now we can alter the target tables | ||
run_sql_with_exceptions(WRITABLE_RAW_SESSIONS_ADD_VITALS_LCP_COLUMN_SQL()), | ||
run_sql_with_exceptions(DISTRIBUTED_RAW_SESSIONS_ADD_VITALS_LCP_COLUMN_SQL()), | ||
run_sql_with_exceptions(BASE_RAW_SESSIONS_ADD_VITALS_LCP_COLUMN_SQL()), | ||
# and then recreate the materialized view and view | ||
run_sql_with_exceptions(RAW_SESSIONS_TABLE_MV_SQL()), | ||
run_sql_with_exceptions(RAW_SESSIONS_VIEW_SQL()), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.