From 396acf3bbbe00a192cb0ea0a9ccf91b1d8d2850b Mon Sep 17 00:00:00 2001
From: Fuwn <50817549+Fuwn@users.noreply.github.com>
Date: Sat, 24 Jan 2026 13:09:50 +0000
Subject: Initial commit

Created from https://vercel.com/new
---
 db/clickhouse/migrations/03_session_data.sql | 57 ++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 db/clickhouse/migrations/03_session_data.sql

(limited to 'db/clickhouse/migrations/03_session_data.sql')

diff --git a/db/clickhouse/migrations/03_session_data.sql b/db/clickhouse/migrations/03_session_data.sql
new file mode 100644
index 0000000..1ed2c06
--- /dev/null
+++ b/db/clickhouse/migrations/03_session_data.sql
@@ -0,0 +1,57 @@
+CREATE TABLE umami.event_data_new
+(
+    website_id UUID,
+    session_id UUID,
+    event_id UUID,
+    url_path String,
+    event_name String,
+    data_key String,
+    string_value Nullable(String),
+    number_value Nullable(Decimal64(4)),
+    date_value Nullable(DateTime('UTC')),
+    data_type UInt32,
+    created_at DateTime('UTC'),
+    job_id Nullable(UUID)
+)
+    engine = MergeTree
+        ORDER BY (website_id, event_id, data_key, created_at)
+        SETTINGS index_granularity = 8192;
+
+INSERT INTO umami.event_data_new
+SELECT website_id,
+    session_id,
+    event_id,
+    url_path,
+    event_name,
+    event_key,
+    string_value,
+    number_value,
+    date_value,
+    data_type,
+    created_at,
+    NULL
+FROM umami.event_data;
+
+CREATE TABLE umami.session_data
+(
+    website_id UUID,
+    session_id UUID,
+    data_key String,
+    string_value Nullable(String),
+    number_value Nullable(Decimal64(4)),
+    date_value Nullable(DateTime('UTC')),
+    data_type UInt32,
+    created_at DateTime('UTC'),
+    job_id Nullable(UUID)
+)
+    engine = MergeTree
+        ORDER BY (website_id, session_id, data_key, created_at)
+        SETTINGS index_granularity = 8192;
+
+RENAME TABLE umami.event_data TO umami.event_data_old;
+RENAME TABLE umami.event_data_new TO umami.event_data;
+
+/*
+DROP TABLE umami.event_data_old
+ */
+
-- 
cgit v1.2.3

