-
Notifications
You must be signed in to change notification settings - Fork 10
/
init.sql
112 lines (101 loc) · 2.97 KB
/
init.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
-- MySQL 8
CREATE DATABASE IF NOT EXISTS game;
USE game;
DROP TABLE IF EXISTS user_info;
CREATE TABLE user_info (
id INT AUTO_INCREMENT PRIMARY KEY,
nickname VARCHAR(50) NOT NULL,
sex int not null,
icon varchar(255) not null default '',
plate_icon varchar(255) not null default '',
time_zone float not null default 0,
email varchar(64) not null,
ip varchar(32) not null,
client_version varchar(32) not null,
mac varchar(24) not null,
imei varchar(24) not null,
imsi varchar(24) not null,
chan_id varchar(32) not null,
server_location varchar(32) not null default '',
create_time TIMESTAMP not null default current_TIMESTAMP
);
DROP TABLE IF EXISTS item_log;
CREATE TABLE item_log (
id INT AUTO_INCREMENT PRIMARY KEY,
`uid` INT NOT NULL,
item_id INT NOT NULL,
way varchar(64) not null,
num INT NOT NULL,
balance INT NOT NULL,
uuid varchar(64) NOT NULL,
create_time TIMESTAMP NOT NULL
);
DROP TABLE IF EXISTS online_log;
CREATE TABLE online_log (
id INT AUTO_INCREMENT PRIMARY KEY,
`uid` INT NOT NULL,
ip varchar(48) NOT NULL,
imei varchar(18) NOT NULL,
imsi varchar(16) NOT NULL,
chan_id varchar(32) NOT NULL,
client_version varchar(32) NOT NULL,
login_time TIMESTAMP NOT NULL,
offline_time TIMESTAMP
);
DROP TABLE IF EXISTS user_plate;
CREATE TABLE user_plate (
id INT AUTO_INCREMENT PRIMARY KEY,
`uid` INT NOT NULL,
plate varchar(16) not null,
open_id varchar(48) NOT NULL,
create_time TIMESTAMP NOT NULL,
index idx_uid(`uid`),
unique index idx_open_id(open_id)
);
DROP TABLE IF EXISTS user_bin;
CREATE TABLE user_bin (
id INT AUTO_INCREMENT PRIMARY KEY,
`uid` INT NOT NULL,
`class` varchar(16) not null,
bin blob not null,
update_time TIMESTAMP NOT NULL,
unique index idx_uid_class(`uid`,`class`)
);
DROP TABLE IF EXISTS mail;
CREATE TABLE mail (
id INT AUTO_INCREMENT PRIMARY KEY,
`type` INT NOT NULL,
send_uid int not null,
recv_uid int not null,
`status` int not null,
`data` text not null,
send_time TIMESTAMP NOT NULL default current_TIMESTAMP,
index idx_recv_uid(recv_uid)
);
DROP TABLE IF EXISTS dict;
CREATE TABLE dict (
id INT AUTO_INCREMENT PRIMARY KEY,
`key` varchar(32) not null,
`value` JSON not null,
update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
index idx_key(`key`)
);
CREATE DATABASE IF NOT EXISTS manage;
USE manage;
DROP TABLE IF EXISTS gm_table;
CREATE TABLE gm_table (
id INT AUTO_INCREMENT PRIMARY KEY,
`name` varchar(32) not null,
`version` int NOT NULL,
content text not null,
update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
index idx_name(`name`)
);
DROP TABLE IF EXISTS gm_script;
CREATE TABLE gm_script (
id INT AUTO_INCREMENT PRIMARY KEY,
`name` varchar(32) not null,
body text not null,
update_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
index idx_name(`name`)
);