-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathsqlite_schema.sql
More file actions
207 lines (201 loc) · 9.13 KB
/
sqlite_schema.sql
File metadata and controls
207 lines (201 loc) · 9.13 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/* initialize database with command: sqlite3 lola.db < sqlite_schema.sql */
CREATE TABLE `Summoner` (
-- `id` integer NOT NULL,
`summoner_id` text NOT NULL UNIQUE, /*key*/
`summoner_name` text NOT NULL,
`is_crawled` integer NOT NULL
-- PRIMARY KEY(id)
);
CREATE TABLE `Match` (
-- `id` integer NOT NULL,
`match_id` text NOT NULL UNIQUE, /*key*/
`version` text NOT NULL,
`duration` integer NOT NULL,
-- `season` text NOT NULL,
`data` text,
`is_crawled` integer NOT NULL,
`is_counted` integer NOT NULL /*for ChampionMatchStats*/
-- PRIMARY KEY(id)
);
CREATE TABLE `MatchChampion` (
`match_id` integer NOT NULL, /*key*/
`participant1` text,
`participant2` text,
`participant3` text,
`participant4` text,
`participant5` text,
`participant6` text,
`participant7` text,
`participant8` text,
`participant9` text,
`participant10` text
);
CREATE TABLE `FrameKillEvent` (
-- `id` integer NOT NULL,
`match_id` text NOT NULL, /*key*/
`happen` integer NOT NULL, /*key*/
`victim` text NOT NULL, /*key*/
`minute` integer NOT NULL,
`killer` text NOT NULL,
`assist` text
-- PRIMARY KEY(id)
);
CREATE TABLE `Team` (
-- `id` integer NOT NULL,
`match_id` text NOT NULL, /*key*/
`side` text NOT NULL, /*key*/
`dragon_kills` integer NOT NULL,
`baron_kills` integer NOT NULL,
`win` integer NOT NULL
-- PRIMARY KEY(id)
);
CREATE TABLE `TeamBan` (
-- `id` integer NOT NULL,
`match_id` text NOT NULL, /*key*/
`side` text NOT NULL, /*key*/
`ban` text NOT NULL /*key*/
-- PRIMARY KEY(id)
);
CREATE TABLE `Participant` (
-- `id` integer NOT NULL,
`summoner_id` text NOT NULL, /*key*/
`match_id` text NOT NULL, /*key*/
`participant_id` text NOT NULL,
`side` text NOT NULL,
`champion` text NOT NULL,
`previous_season_tier` text,
`summoner_spell_d` text NOT NULL,
`summoner_spell_f` text NOT NULL,
`kda` real NOT NULL,
`kills` integer NOT NULL,
`deaths` integer NOT NULL,
`assists` integer NOT NULL,
`champion_level` integer NOT NULL,
`turret_kills` integer NOT NULL,
`cs` integer NOT NULL, /*minion + monster kills*/
`killing_sprees` integer NOT NULL,
`largest_critical_strike` integer NOT NULL,
`largest_killing_spree` integer NOT NULL,
`largest_multi_kill` integer NOT NULL,
`gold_earned` integer NOT NULL,
`gold_spent` integer NOT NULL,
`magic_damage_dealt` integer NOT NULL,
`magic_damage_dealt_to_champions` integer NOT NULL,
`magic_damage_taken` integer NOT NULL,
`physical_damage_dealt` integer NOT NULL,
`physical_damage_dealt_to_champions` integer NOT NULL,
`physical_damage_taken` integer NOT NULL,
`true_damage_dealt` integer NOT NULL,
`true_damage_dealt_to_champions` integer NOT NULL,
`true_damage_taken` integer NOT NULL,
`damage_dealt` integer NOT NULL,
`damage_dealt_to_champions` integer NOT NULL,
`damage_taken` integer NOT NULL,
`healing_done` integer NOT NULL,
`units_healed` integer NOT NULL,
`crowd_control_dealt` integer NOT NULL,
`vision_wards_bought` integer NOT NULL,
`ward_kills` integer NOT NULL,
`wards_placed` integer NOT NULL,
`participant_win` integer NOT NULL,
CONSTRAINT unq_match_participant UNIQUE(match_id, participant_id)
-- PRIMARY KEY(id)
);
CREATE TABLE `ParticipantTimeline` (
-- `id` integer NOT NULL,
`summoner_id` text NOT NULL, /*key*/
`match_id` text NOT NULL, /*key*/
`delta` text NOT NULL, /*key*/
`side` text NOT NULL,
`participant_id` text NOT NULL,
`role` text NOT NULL,
`lane` text NOT NULL,
`creeps_per_min_delta` real,
`cs_diff_per_min_delta` real,
`gold_per_min_delta` real,
`xp_per_min_delta` real,
`xp_diff_per_min_delta` real,
`damage_taken_per_min_delta` real,
`damage_taken_diff_per_min_delta` real
-- PRIMARY KEY(id)
);
CREATE TABLE `ChampionMatchStats` (
`champion` TEXT NOT NULL UNIQUE, /*key*/
`picks` integer NOT NULL DEFAULT 0,
`bans` integer NOT NULL DEFAULT 0,
`wins` integer NOT NULL DEFAULT 0,
`kills` integer NOT NULL DEFAULT 0,
`deaths` integer NOT NULL DEFAULT 0,
`assists` integer NOT NULL DEFAULT 0,
`gold_earned` integer NOT NULL DEFAULT 0,
`magic_damage` integer NOT NULL DEFAULT 0,
`physical_damage` integer NOT NULL DEFAULT 0,
`true_damage` integer NOT NULL DEFAULT 0,
`damage_taken` integer NOT NULL DEFAULT 0,
`crowd_control_dealt` integer NOT NULL DEFAULT 0,
`ward_kills` integer NOT NULL DEFAULT 0,
`wards_placed` integer NOT NULL DEFAULT 0,
`team_kills` integer NOT NULL DEFAULT 0,
`team_deaths` integer NOT NULL DEFAULT 0,
`team_assists` integer NOT NULL DEFAULT 0,
`team_gold_earned` integer NOT NULL DEFAULT 0,
`team_magic_damage` integer NOT NULL DEFAULT 0,
`team_physical_damage` integer NOT NULL DEFAULT 0,
`team_true_damage` integer NOT NULL DEFAULT 0,
`team_damage_taken` integer NOT NULL DEFAULT 0,
`team_crowd_control_dealt` integer NOT NULL DEFAULT 0,
`team_ward_kills` integer NOT NULL DEFAULT 0,
`team_wards_placed` integer NOT NULL DEFAULT 0,
`label` integer DEFAULT 0,
`version` text,
`avg_tier` text
);
CREATE TABLE `ChampionRank` (
`champion` text NOT NULL UNIQUE, /*key*/
`pick_rate` real NOT NULL DEFAULT 0,
`ban_rate` real NOT NULL DEFAULT 0,
`win_rate` real NOT NULL DEFAULT 0,
`kill_rate` real NOT NULL DEFAULT 0,
`assist_rate` real NOT NULL DEFAULT 0,
`death_rate` real NOT NULL DEFAULT 0,
`eigen` real NOT NULL DEFAULT 0,
`eigen_ratio` real NOT NULL DEFAULT 0,
`eigen_diff` real NOT NULL DEFAULT 0,
`pagerank` real NOT NULL DEFAULT 0,
`hits` real NOT NULL DEFAULT 0,
`version` text,
`avg_tier` text
-- kill / death / eigen / pagerank...
);
CREATE TABLE `ChampionKillMatrix` (
-- `id` integer NOT NULL,
`killer` text NOT NULL,
`victim` text NOT NULL,
`kills` integer NOT NULL,
`version` text,
`avg_tier` text
-- PRIMARY KEY(id)
);
CREATE TABLE `ChampionAssistMatrix` (
-- `id` integer NOT NULL,
`killer` text NOT NULL, /*key*/
`assist` text NOT NULL, /*key*/
`assists` integer NOT NULL,
`version` text,
`avg_tier` text
-- PRIMARY KEY(id)
);
CREATE TABLE `ChampionIncidenceMatrix` (
-- `id` integer NOT NULL,
`champion_1` text NOT NULL, /*key*/
`champion_2` text NOT NULL, /*key*/
`counters` integer NOT NULL,
`partners` integer NOT NULL,
`version` text,
`avg_tier` text
-- PRIMARY KEY(id)
);
CREATE INDEX index_Participant_match_id on Participant(match_id);
CREATE UNIQUE INDEX killer_victim on ChampionKillMatrix(killer, victim);
CREATE UNIQUE INDEX killer_assist on ChampionAssistMatrix(killer, assist);
-- INSERT INTO new.Participant SELECT * FROM old.Participant ORDER bY match_id ASC, CAST(participant_id AS INTEGER) ASC