Files
3pmonitor/clickhouse/init.sql
Junaid Saeed Uppal 85f44e6a22 Initial commit: Teen Patti live monitor with analytics
Live dashboard with real-time WebSocket updates, analytics page with
time-filtered stats, ClickHouse storage, and Caddy reverse proxy.
2026-02-21 22:36:40 +05:00

43 lines
1.1 KiB
SQL

CREATE TABLE IF NOT EXISTS games (
game_no UInt64,
winner UInt8,
total_pot UInt64,
bet_a UInt64,
bet_b UInt64,
bet_c UInt64,
hand_a String,
hand_b String,
hand_c String,
hand_type_a UInt8,
hand_type_b UInt8,
hand_type_c UInt8,
cards_json String,
duration_s UInt32,
created_at DateTime DEFAULT now()
) ENGINE = ReplacingMergeTree()
ORDER BY game_no;
CREATE TABLE IF NOT EXISTS bets (
game_no UInt64,
user_id UInt64,
chair UInt8,
bet_amount UInt64,
total_bet UInt64,
created_at DateTime64(3) DEFAULT now64(3)
) ENGINE = MergeTree()
ORDER BY (game_no, user_id, created_at);
CREATE TABLE IF NOT EXISTS users (
user_id UInt64,
nick_name String,
rich_level UInt16,
actor_level UInt16,
gender UInt8,
consume_total UInt64,
earn_total UInt64,
is_actor UInt8,
portrait String,
updated_at DateTime DEFAULT now()
) ENGINE = ReplacingMergeTree(updated_at)
ORDER BY user_id;