diff --git a/初始化事件表.sql b/初始化事件表.sql index dca07d0..fc19c14 100644 --- a/初始化事件表.sql +++ b/初始化事件表.sql @@ -1,51 +1,61 @@ -drop table if exists debug.event; -create table debug.event +-- auto-generated definition +create table event ( - `#ip` Nullable(IPv4), - `#country` Nullable(String), - `#country_code` Nullable(String), - `#province` Nullable(String), - `#city` Nullable(String), - `#os_version` Nullable(String), - `#manufacturer` Nullable(String), - `#os` Nullable(String), - `#device_id` Nullable(String), - `#screen_height` Nullable(UInt16), - `#screen_width` Nullable(UInt16), - `#device_model` Nullable(String), - `#app_version` Nullable(String), - `#bundle_id` Nullable(String), - `#lib` Nullable(String), - `#lib_version` Nullable(String), - `#network_type` Nullable(String), - `#carrier` Nullable(String), - `#browser` Nullable(String), - `#browser_version` Nullable(String), - `#duration` Nullable(String), - `#url` Nullable(String), - `#url_path` Nullable(String), - `#referrer` Nullable(String), - `#referrer_host` Nullable(String), - `#title` Nullable(String), - `#screen_name` Nullable(String), - `#element_id` Nullable(String), - `#element_type` Nullable(String), - `#resume_from_background` Nullable(String), - `#element_selector` Nullable(String), - `#element_position` Nullable(String), - `#element_content` Nullable(String), - `#scene` Nullable(String), - `#mp_platform` Nullable(String), - `#app_crashed_reason` Nullable(String), - `#zone_offset` Int8 default 8, - `#event_id` String, + `#ip` Nullable(IPv4), + `#country` Nullable(String), + `#province` Nullable(String), + `#city` Nullable(String), + `#os` Nullable(String), + `#device_id` Nullable(String), + `#screen_height` Nullable(UInt16), + `#screen_width` Nullable(UInt16), + `#device_model` Nullable(String), + `#app_version` Nullable(String), + `#bundle_id` Nullable(String), + `#app_name` Nullable(String), + `#game_version` Nullable(String), + `#os_version` Nullable(String), + `#network_type` Nullable(String), + `#carrier` Nullable(String), + `#manufacturer` Nullable(String), + `#app_id` Nullable(String), + `#account_id` String, + `#distinct_id` Nullable(String), + binduid Nullable(String), + channel Nullable(String), + owner_name String default '', + role_name Nullable(String), + exp Nullable(UInt64), + zhanli Nullable(UInt64), + maxmapid Nullable(UInt16), + mapid Nullable(UInt16), + ghid Nullable(String), + rmbmoney Nullable(UInt64), + jinbi Nullable(UInt64), + svrindex Nullable(String), + lv Nullable(UInt16), + vip Nullable(UInt16), + game Nullable(String), + + `#zone_offset` Int8 default 8, + `#event_time` DateTime('UTC'), + `#event_name` String, + `#server_time` DateTime('UTC') default now(), + + unitPrice Nullable(UInt16), + money Nullable(String), + islishishouci Nullable(UInt8), + isdangrishouci Nullable(UInt8), + is_today_reg Nullable(UInt8), + orderid Nullable(String), + proid Nullable(String), + step_id Nullable(UInt16), + step_group Nullable(UInt16), + guide_start_time Nullable(DateTime('UTC')), + online_ts Nullable(UInt16), + `#time` Nullable(DateTime('UTC')) +) + engine = ReplacingMergeTree PARTITION BY toYYYYMMDD(`#event_time`) + ORDER BY (owner_name, `#event_name`, `#event_time`, `#account_id`) + SETTINGS index_granularity = 8192; - `#event_time` DateTime('UTC'), - `#account_id` String, - `#distinct_id` Nullable(String), - `#event_name` String, - `#server_time` DateTime('UTC') default now() -) ENGINE = ReplacingMergeTree() - PARTITION BY toYYYYMMDD(`#event_time`) - order by (`#event_name`, `#event_time`, `#account_id`) --- TTL event_time + toIntervalDay(365) \ No newline at end of file