-
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.
feat: snapshot library CH column migration (#26867)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: James Greenhill <[email protected]>
- Loading branch information
1 parent
ed0ba35
commit eaf9de7
Showing
4 changed files
with
69 additions
and
7 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
posthog/clickhouse/migrations/0095_add_snapshot_library_tracking.py
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,26 @@ | ||
from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions | ||
from posthog.session_recordings.sql.session_replay_event_migrations_sql import ( | ||
DROP_SESSION_REPLAY_EVENTS_TABLE_MV_SQL, | ||
DROP_KAFKA_SESSION_REPLAY_EVENTS_TABLE_SQL, | ||
ADD_LIBRARY_SESSION_REPLAY_EVENTS_TABLE_SQL, | ||
ADD_LIBRARY_WRITABLE_SESSION_REPLAY_EVENTS_TABLE_SQL, | ||
ADD_LIBRARY_DISTRIBUTED_SESSION_REPLAY_EVENTS_TABLE_SQL, | ||
) | ||
from posthog.session_recordings.sql.session_replay_event_sql import ( | ||
SESSION_REPLAY_EVENTS_TABLE_MV_SQL, | ||
KAFKA_SESSION_REPLAY_EVENTS_TABLE_SQL, | ||
) | ||
|
||
operations = [ | ||
# we have to drop materialized view first so that we're no longer pulling from kakfa | ||
# then we drop the kafka table | ||
run_sql_with_exceptions(DROP_SESSION_REPLAY_EVENTS_TABLE_MV_SQL()), | ||
run_sql_with_exceptions(DROP_KAFKA_SESSION_REPLAY_EVENTS_TABLE_SQL()), | ||
# now we can alter the target tables | ||
run_sql_with_exceptions(ADD_LIBRARY_SESSION_REPLAY_EVENTS_TABLE_SQL()), | ||
run_sql_with_exceptions(ADD_LIBRARY_DISTRIBUTED_SESSION_REPLAY_EVENTS_TABLE_SQL()), | ||
run_sql_with_exceptions(ADD_LIBRARY_WRITABLE_SESSION_REPLAY_EVENTS_TABLE_SQL()), | ||
# and then recreate the materialized views and kafka tables | ||
run_sql_with_exceptions(KAFKA_SESSION_REPLAY_EVENTS_TABLE_SQL()), | ||
run_sql_with_exceptions(SESSION_REPLAY_EVENTS_TABLE_MV_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
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
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