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;
