From 50cb5c647339bcc6bee500250dee40287bd36725 Mon Sep 17 00:00:00 2001 From: Mars Ultor Date: Tue, 23 Dec 2025 22:24:21 -0600 Subject: [PATCH] sql stuff in --- setup.sql | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.cpp | 3 ++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 setup.sql diff --git a/setup.sql b/setup.sql new file mode 100644 index 0000000..c47657b --- /dev/null +++ b/setup.sql @@ -0,0 +1,50 @@ +USE minecraft; + +CREATE TABLE mc_client_events ( + user_id String, + + timestamp DateTime, + + event_type Enum8( + 'start' = 1, + 'end' = 2 + ), + + log_source LowCardinality(String) -- latest.log or YYYY-MM-DD-n.log.gz +) +ENGINE = MergeTree +PARTITION BY toDate(timestamp) +ORDER BY (user_id, timestamp); + +CREATE TABLE mc_chat_events ( + user_id String, + + timestamp DateTime, + + sender String, + message String +) +ENGINE = MergeTree +PARTITION BY toDate(timestamp) +ORDER BY (user_id, timestamp); + +CREATE TABLE mc_activity_events ( + user_id String, + + timestamp DateTime, + + event_type Enum8( + 'command' = 1, + 'death' = 2, + 'dimension' = 3, + 'other' = 4 + ), + + confidence Float32 +) +ENGINE = MergeTree +PARTITION BY toDate(timestamp) +ORDER BY (user_id, timestamp); + + +SHOW TABLES; diff --git a/src/main.cpp b/src/main.cpp index fdd5017..bb39370 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,7 +8,8 @@ int main (int argc, char *argv[]) { if(log_path.empty()) throw std::runtime_error("your dumbass can't put in a path"); std::string clickhouse_username = config["clickhouse"]["username"].value_or(""); std::string clickouse_password = config["clickhouse"]["password"].value_or(""); - if(clickhouse_username.empty() || clickouse_password.empty()) throw std::runtime_error("put the creds in the right place idiot"); + std::string clickhouse_db = config["clickhouse"]["db"].value_or(""); + if(clickhouse_username.empty() || clickouse_password.empty() || clickhouse_db.empty()) throw std::runtime_error("put the creds in the right place idiot"); return 0; }