diff --git a/db/clickhouse/migrations/10_add_session_recording.sql b/db/clickhouse/migrations/10_add_session_recording.sql new file mode 100644 index 000000000..b873bfc5f --- /dev/null +++ b/db/clickhouse/migrations/10_add_session_recording.sql @@ -0,0 +1,17 @@ +-- Create session_replay +CREATE TABLE umami.session_replay +( + replay_id UUID, + website_id UUID, + session_id UUID, + chunk_index UInt32, + events String CODEC(ZSTD(3)), + event_count UInt32, + started_at DateTime64(6), + ended_at DateTime64(6), + created_at DateTime64(6) DEFAULT now64(6) +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(created_at) +ORDER BY (replay_id, website_id, session_id, chunk_index) +SETTINGS index_granularity = 8192; \ No newline at end of file diff --git a/db/clickhouse/schema.sql b/db/clickhouse/schema.sql index a16faa58c..18f634563 100644 --- a/db/clickhouse/schema.sql +++ b/db/clickhouse/schema.sql @@ -354,3 +354,21 @@ SELECT toStartOfHour(created_at) as created_at FROM umami.website_performance GROUP BY website_id, url_path, toStartOfHour(created_at); + +-- Create session_replay +CREATE TABLE umami.session_replay +( + replay_id UUID, + website_id UUID, + session_id UUID, + chunk_index UInt32, + events String CODEC(ZSTD(3)), + event_count UInt32, + started_at DateTime64(6), + ended_at DateTime64(6), + created_at DateTime64(6) DEFAULT now64(6) +) +ENGINE = MergeTree() +PARTITION BY toYYYYMM(created_at) +ORDER BY (replay_id, website_id, session_id, chunk_index) +SETTINGS index_granularity = 8192; \ No newline at end of file