forked from crawl/sequell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhenzell.sql
193 lines (175 loc) · 4.81 KB
/
henzell.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
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
DROP TABLE IF EXISTS milestone;
DROP TABLE IF EXISTS spr_milestone;
DROP TABLE IF EXISTS zot_milestone;
DROP TABLE IF EXISTS milestone_files;
DROP TABLE IF EXISTS logrecord;
DROP TABLE IF EXISTS spr_logrecord;
DROP TABLE IF EXISTS zot_logrecord;
DROP TABLE IF EXISTS logfiles;
DROP SEQUENCE IF EXISTS spr_logrecord_seq;
DROP SEQUENCE IF EXISTS zot_logrecord_seq;
DROP SEQUENCE IF EXISTS spr_milestone_seq;
DROP SEQUENCE IF EXISTS zot_milestone_seq;
CREATE TABLE logfiles (
file CITEXT PRIMARY KEY
);
CREATE TABLE milestone_files (
file CITEXT PRIMARY KEY
);
CREATE TABLE logrecord (
id SERIAL,
file_offset BIGINT,
file CITEXT,
-- 'y' for alpha, anything else otherwise.
alpha CITEXT,
src CITEXT,
v CITEXT,
cv CITEXT,
lv CITEXT,
sc BIGINT,
pname CITEXT,
game_key VARCHAR(50),
uid INT,
race CITEXT,
crace CITEXT,
cls CITEXT,
charabbrev CITEXT,
xl INT,
sk CITEXT,
sklev INT,
title CITEXT,
ktyp CITEXT,
killer CITEXT,
ckiller CITEXT,
ikiller CITEXT,
kpath CITEXT,
kmod CITEXT,
kaux CITEXT,
ckaux CITEXT,
place CITEXT,
mapname CITEXT,
mapdesc CITEXT,
br CITEXT,
lvl INT,
ltyp CITEXT,
hp INT,
mhp INT,
mmhp INT,
dam INT,
sstr INT,
sint INT,
sdex INT,
god CITEXT,
piety INT,
pen INT,
wiz INT,
tstart TIMESTAMP,
tend TIMESTAMP,
rstart CITEXT,
rend CITEXT,
dur BIGINT,
turn BIGINT,
urune INT,
nrune INT,
tmsg CITEXT,
vmsg CITEXT,
splat CITEXT,
tiles CITEXT,
-- How many times it's been played on FooTV
ntv INT DEFAULT 0,
PRIMARY KEY (id)
);
CREATE INDEX ind_foffset ON logrecord (file, file_offset);
CREATE INDEX ind_milelocate ON logrecord (src, pname, rstart);
CREATE TABLE spr_logrecord AS
SELECT * FROM logrecord LIMIT 1;
TRUNCATE TABLE spr_logrecord;
CREATE SEQUENCE spr_logrecord_seq;
ALTER TABLE spr_logrecord ALTER COLUMN id SET DEFAULT NEXTVAL('spr_logrecord_seq');
ALTER TABLE spr_logrecord ADD PRIMARY KEY (id);
CREATE INDEX spr_ind_foffset ON spr_logrecord (file, file_offset);
CREATE INDEX spr_ind_milelocate ON spr_logrecord (src, pname, rstart);
CREATE TABLE zot_logrecord AS
SELECT * FROM logrecord LIMIT 1;
TRUNCATE TABLE zot_logrecord;
CREATE SEQUENCE zot_logrecord_seq;
ALTER TABLE zot_logrecord ALTER COLUMN id SET DEFAULT NEXTVAL('zot_logrecord_seq');
ALTER TABLE zot_logrecord ADD PRIMARY KEY (id);
CREATE INDEX zot_ind_foffset ON zot_logrecord (file, file_offset);
CREATE INDEX zot_ind_milelocate ON zot_logrecord (src, pname, rstart);
CREATE TABLE milestone (
id SERIAL,
file_offset BIGINT,
file CITEXT,
alpha CITEXT,
tiles CITEXT,
src CITEXT,
v CITEXT,
cv CITEXT,
pname CITEXT,
game_key VARCHAR(50),
race CITEXT,
crace CITEXT,
cls CITEXT,
charabbrev CITEXT,
xl INT,
sk CITEXT,
sklev INT,
title CITEXT,
place CITEXT,
oplace CITEXT,
br CITEXT,
lvl INT,
ltyp CITEXT,
hp INT,
mhp INT,
mmhp INT,
sstr INT,
sint INT,
sdex INT,
god CITEXT,
dur BIGINT,
turn BIGINT,
urune INT,
nrune INT,
ttime TIMESTAMP,
rstart CITEXT,
rtime CITEXT,
-- Known milestones: abyss.enter, abyss.exit, rune, orb, ghost, uniq,
-- uniq.ban, br.enter, br.end.
verb CITEXT,
noun CITEXT,
-- The actual milestone message for Henzell to report.
milestone CITEXT,
-- How many times it's been played on FooTV
ntv INT DEFAULT 0,
PRIMARY KEY(id)
);
CREATE INDEX mile_lookup_ext ON milestone (verb, noun);
CREATE INDEX mile_ind_foffset ON milestone (file, file_offset);
CREATE INDEX mile_lookup ON milestone (game_key, verb);
CREATE INDEX mile_game_key ON milestone (game_key);
CREATE TABLE spr_milestone AS
SELECT * FROM milestone LIMIT 1;
TRUNCATE TABLE spr_milestone;
CREATE SEQUENCE spr_milestone_seq;
ALTER TABLE spr_milestone ALTER COLUMN id SET DEFAULT NEXTVAL('spr_milestone_seq');
ALTER TABLE spr_milestone ADD PRIMARY KEY (id);
CREATE INDEX spr_mile_lookup_ext ON spr_milestone (verb, noun);
CREATE INDEX spr_mile_ind_foffset ON spr_milestone (file, file_offset);
CREATE INDEX spr_mile_lookup ON spr_milestone (game_key, verb);
CREATE INDEX spr_mile_game_key ON spr_milestone (game_key);
CREATE TABLE zot_milestone AS
SELECT * FROM milestone LIMIT 1;
TRUNCATE TABLE zot_milestone;
CREATE SEQUENCE zot_milestone_seq;
ALTER TABLE zot_milestone ALTER COLUMN id SET DEFAULT NEXTVAL('zot_milestone_seq');
ALTER TABLE zot_milestone ADD PRIMARY KEY (id);
CREATE INDEX zot_mile_lookup_ext ON zot_milestone (verb, noun);
CREATE INDEX zot_mile_ind_foffset ON zot_milestone (file, file_offset);
CREATE INDEX zot_mile_lookup ON zot_milestone (game_key, verb);
CREATE INDEX zot_mile_game_key ON zot_milestone (game_key);
DROP TABLE IF EXISTS canary;
CREATE TABLE canary (
last_update TIMESTAMP
);