138 lines
2.8 KiB
MySQL
138 lines
2.8 KiB
MySQL
|
CREATE TABLE ods_game_order (
|
||
|
game_id int NOT NULL,
|
||
|
order_id VARCHAR NOT NULL,
|
||
|
status int NOT NULL,
|
||
|
user_account VARCHAR,
|
||
|
role_id VARCHAR,
|
||
|
server_id int,
|
||
|
platform_id VARCHAR,
|
||
|
product_id VARCHAR,
|
||
|
amount bigint,
|
||
|
create_time DATETIME,
|
||
|
ds VARCHAR,
|
||
|
receive_time DATETIME
|
||
|
)
|
||
|
UNIQUE KEY (game_id, order_id, status) DISTRIBUTED BY HASH (game_id) BUCKETS 32;
|
||
|
|
||
|
CREATE TABLE ods_order_history (
|
||
|
id bigint NOT NULL,
|
||
|
orderid VARCHAR NOT NULL,
|
||
|
account VARCHAR,
|
||
|
platformid VARCHAR,
|
||
|
serverid bigint,
|
||
|
username VARCHAR,
|
||
|
roleid VARCHAR,
|
||
|
money bigint,
|
||
|
yuanbao bigint,
|
||
|
goods bigint,
|
||
|
level bigint,
|
||
|
`time` bigint,
|
||
|
gid bigint
|
||
|
)
|
||
|
UNIQUE KEY (id, orderid) DISTRIBUTED BY HASH (id) BUCKETS 32;
|
||
|
|
||
|
|
||
|
drop TABLE ods_role;
|
||
|
CREATE TABLE ods_role (
|
||
|
game_id int NOT NULL,
|
||
|
server_id int NOT NULL,
|
||
|
role_id VARCHAR NOT NULL,
|
||
|
user_account VARCHAR,
|
||
|
role_name VARCHAR,
|
||
|
job int,
|
||
|
level int,
|
||
|
exp bigint,
|
||
|
relevel int,
|
||
|
platform_id VARCHAR,
|
||
|
create_time DATETIME,
|
||
|
ds date,
|
||
|
main_server_id int,
|
||
|
update_time DATETIME,
|
||
|
is_del int
|
||
|
)
|
||
|
UNIQUE KEY (game_id, server_id, role_id) DISTRIBUTED BY HASH (game_id) BUCKETS 32;
|
||
|
|
||
|
|
||
|
CREATE TABLE ods_role_duration (
|
||
|
game_id int NOT NULL,
|
||
|
server_id int NOT NULL,
|
||
|
role_id VARCHAR NOT NULL,
|
||
|
create_time DATETIME NOT NULL,
|
||
|
|
||
|
user_account VARCHAR,
|
||
|
duration int,
|
||
|
level int,
|
||
|
role_name VARCHAR
|
||
|
)
|
||
|
UNIQUE KEY (game_id, server_id, role_id, create_time) DISTRIBUTED BY HASH (game_id) BUCKETS 32;
|
||
|
|
||
|
|
||
|
|
||
|
CREATE TABLE ods_rollserv_user (
|
||
|
game_id int,
|
||
|
server_id int,
|
||
|
user_account VARCHAR,
|
||
|
role_id VARCHAR,
|
||
|
role_name VARCHAR,
|
||
|
job int,
|
||
|
level int,
|
||
|
exp bigint,
|
||
|
relevel int,
|
||
|
platform_id VARCHAR,
|
||
|
create_time DATETIME,
|
||
|
ds date NOT NULL
|
||
|
)
|
||
|
ENGINE=OLAP
|
||
|
PARTITION BY RANGE(`ds`) () DISTRIBUTED BY HASH (ds) BUCKETS 32 PROPERTIES
|
||
|
(
|
||
|
"min_load_replica_num" = "-1",
|
||
|
"dynamic_partition.enable" = "true",
|
||
|
"dynamic_partition.time_unit" = "DAY",
|
||
|
"dynamic_partition.time_zone" = "Asia/Shanghai",
|
||
|
"dynamic_partition.start" = "-180",
|
||
|
"dynamic_partition.end" = "3",
|
||
|
"dynamic_partition.buckets" = "32",
|
||
|
"dynamic_partition.create_history_partition" = "true",
|
||
|
"dynamic_partition.prefix" = "p_",
|
||
|
"storage_medium" = "hdd"
|
||
|
);
|
||
|
|
||
|
|
||
|
CREATE TABLE ods_rollserv_user_r (
|
||
|
game_id int,
|
||
|
server_id int,
|
||
|
user_account VARCHAR,
|
||
|
role_id VARCHAR,
|
||
|
role_name VARCHAR,
|
||
|
job int,
|
||
|
level int,
|
||
|
exp bigint,
|
||
|
relevel int,
|
||
|
platform_id VARCHAR
|
||
|
)
|
||
|
DISTRIBUTED BY HASH (game_id) BUCKETS 32 ;
|
||
|
|
||
|
|
||
|
CREATE TABLE ods_user_profile_lt (
|
||
|
account VARCHAR NOT NULL,
|
||
|
game_id int NOT NULL,
|
||
|
_update_time_ DATETIME NOT NULL,
|
||
|
total_order bigint,
|
||
|
total_payment bigint,
|
||
|
total_played int,
|
||
|
first_login DATETIME,
|
||
|
last_login DATETIME,
|
||
|
gd int,
|
||
|
sd int,
|
||
|
ld int,
|
||
|
score DECIMAL(10,2)
|
||
|
)
|
||
|
UNIQUE KEY (account, game_id) DISTRIBUTED BY HASH (game_id) BUCKETS 32;
|
||
|
|
||
|
|
||
|
CREATE TABLE ods_user_profile_player (
|
||
|
account VARCHAR NOT NULL,
|
||
|
game_id int NOT NULL,
|
||
|
_update_time_ DATETIME NOT NULL
|
||
|
)
|
||
|
UNIQUE KEY (account, game_id) DISTRIBUTED BY HASH ( game_id) BUCKETS 32;
|