forked from splitbrain/dokuwiki-plugin-statistics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.sql
260 lines (239 loc) · 7.88 KB
/
db.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
CREATE TABLE `stats_access` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`dt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`page` VARCHAR(255)
COLLATE utf8_unicode_ci NOT NULL,
`ip` VARCHAR(15)
COLLATE utf8_unicode_ci NOT NULL,
`ua` VARCHAR(255)
COLLATE utf8_unicode_ci NOT NULL,
`ua_info` VARCHAR(255)
COLLATE utf8_unicode_ci NOT NULL,
`ua_type` VARCHAR(32)
COLLATE utf8_unicode_ci NOT NULL,
`ua_ver` VARCHAR(10)
COLLATE utf8_unicode_ci NOT NULL,
`os` VARCHAR(32)
COLLATE utf8_unicode_ci NOT NULL,
`ref_md5` VARCHAR(32)
COLLATE utf8_unicode_ci NOT NULL,
`ref_type` VARCHAR(32)
COLLATE utf8_unicode_ci NOT NULL,
`ref` TEXT
COLLATE utf8_unicode_ci NOT NULL,
`screen_x` INT(10) UNSIGNED NOT NULL,
`screen_y` INT(10) UNSIGNED NOT NULL,
`view_x` INT(10) UNSIGNED NOT NULL,
`view_y` INT(10) UNSIGNED NOT NULL,
`user` VARCHAR(255)
COLLATE utf8_unicode_ci NOT NULL,
`session` VARCHAR(255)
COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `ref_type` (`ref_type`),
KEY `page` (`page`),
KEY `ref_md5` (`ref_md5`),
KEY `dt` (`dt`)
)
ENGINE =MyISAM
DEFAULT CHARSET =utf8
COLLATE =utf8_unicode_ci;
CREATE TABLE `stats_iplocation` (
`ip` VARCHAR(15)
COLLATE utf8_unicode_ci NOT NULL,
`code` VARCHAR(3)
COLLATE utf8_unicode_ci NOT NULL,
`country` VARCHAR(255)
COLLATE utf8_unicode_ci NOT NULL,
`city` VARCHAR(255)
COLLATE utf8_unicode_ci NOT NULL,
`host` VARCHAR(255)
COLLATE utf8_unicode_ci NOT NULL,
`lastupd` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ip`),
KEY `code` (`code`)
)
ENGINE =MyISAM
DEFAULT CHARSET =utf8
COLLATE =utf8_unicode_ci;
-- UPGRADE added 2007-01-28
ALTER TABLE `stats_access` CHANGE `dt` `dt` DATETIME NOT NULL;
ALTER TABLE `stats_access` ADD `js` TINYINT(1) NOT NULL
AFTER `view_y`;
UPDATE `stats_access`
SET js = 1;
-- UPGRADE added 2007-01-31
ALTER TABLE `stats_access` ADD `uid` VARCHAR(50) NOT NULL;
CREATE TABLE `stats_outlinks` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`dt` DATETIME NOT NULL,
`session` VARCHAR(255)
COLLATE utf8_unicode_ci NOT NULL,
`link_md5` VARCHAR(32)
COLLATE utf8_unicode_ci NOT NULL,
`link` TEXT
COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `link_md5` (`link_md5`)
)
ENGINE =MyISAM
DEFAULT CHARSET =utf8
COLLATE =utf8_unicode_ci;
-- UPGRADE added 2007-02-04
ALTER TABLE `stats_outlinks` ADD `page` VARCHAR(255) NOT NULL
AFTER `dt`;
CREATE TABLE `stats_search` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`dt` DATETIME NOT NULL,
`page` VARCHAR(255)
COLLATE utf8_unicode_ci NOT NULL,
`query` VARCHAR(255)
COLLATE utf8_unicode_ci NOT NULL,
`engine` VARCHAR(255)
COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
)
ENGINE =MyISAM
DEFAULT CHARSET =utf8
COLLATE =utf8_unicode_ci;
CREATE TABLE `stats_searchwords` (
`sid` BIGINT UNSIGNED NOT NULL,
`word` VARCHAR(255) NOT NULL,
PRIMARY KEY (`sid`, `word`)
)
ENGINE = MYISAM
CHARACTER SET utf8
COLLATE utf8_unicode_ci;
-- statistic fixes
UPDATE stats_access
SET ref_type='external'
WHERE ref LIKE 'http://digg.com/%';
UPDATE stats_access
SET ref_type='external'
WHERE ref LIKE 'http://del.icio.us/%';
UPDATE stats_access
SET ref_type='external'
WHERE ref LIKE 'http://www.stumbleupon.com/%';
UPDATE stats_access
SET ref_type='external'
WHERE ref LIKE 'http://swik.net/%';
UPDATE stats_access
SET ref_type='external'
WHERE ref LIKE 'http://segnalo.alice.it/%';
-- UPGRADE added 2008-06-15
CREATE TABLE `stats_refseen` (
`ref_md5` VARCHAR(32)
COLLATE utf8_unicode_ci NOT NULL,
`dt` DATETIME NOT NULL,
PRIMARY KEY (`ref_md5`),
KEY `dt` (`dt`)
)
ENGINE = MYISAM
CHARACTER SET utf8
COLLATE utf8_unicode_ci;
-- This will take some time...
INSERT INTO stats_refseen (`ref_md5`, `dt`) SELECT
`ref_md5`,
MIN(`dt`)
FROM stats_access
GROUP BY `ref_md5`;
-- UPGRADE added 2012-02-08
CREATE TABLE `stats_edits` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`dt` DATETIME NOT NULL,
`ip` VARCHAR(40) NOT NULL,
`user` VARCHAR(255) NOT NULL,
`session` VARCHAR(255) NOT NULL,
`uid` VARCHAR(50) NOT NULL,
`page` VARCHAR(255) NOT NULL,
`type` CHAR(1)
COLLATE 'ascii_bin' NOT NULL
)
ENGINE ='MyISAM'
COLLATE 'utf8_general_ci';
ALTER TABLE `stats_access` CHANGE `ip` `ip` VARCHAR(40);
ALTER TABLE `stats_search` ADD INDEX `engine` (`engine`);
CREATE TABLE `stats_session` (
`session` VARCHAR(255) NOT NULL PRIMARY KEY,
`dt` DATETIME NOT NULL,
`end` DATETIME NOT NULL,
`views` INT UNSIGNED NOT NULL,
`uid` VARCHAR(50) NOT NULL
)
COMMENT =''
ENGINE ='MyISAM'
COLLATE 'utf8_general_ci';
CREATE TABLE `stats_logins` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`dt` DATETIME NOT NULL,
`ip` VARCHAR(40) NOT NULL,
`user` VARCHAR(255) NOT NULL,
`session` VARCHAR(255) NOT NULL,
`uid` VARCHAR(50) NOT NULL,
`type` CHAR(1)
COLLATE 'ascii_bin' NOT NULL
)
ENGINE ='MyISAM'
COLLATE 'utf8_general_ci';
ALTER TABLE `stats_edits` ADD INDEX `dt` (`dt`);
ALTER TABLE `stats_edits` ADD INDEX `type` (`type`);
ALTER TABLE `stats_logins` ADD INDEX `dt` (`dt`);
ALTER TABLE `stats_logins` ADD INDEX `type` (`type`);
ALTER TABLE `stats_outlinks` ADD INDEX `dt` (`dt`);
ALTER TABLE `stats_search` ADD INDEX `dt` (`dt`);
ALTER TABLE `stats_session` ADD INDEX `dt` (`dt`);
ALTER TABLE `stats_session` ADD INDEX `views` (`views`);
ALTER TABLE `stats_session` ADD INDEX `uid` (`uid`);
ALTER TABLE `stats_access` ADD INDEX `ua_type` (`ua_type`);
-- UPGRADE added 2014-06-18
CREATE TABLE `stats_lastseen` (
`user` VARCHAR(255) NOT NULL,
`dt` TIMESTAMP NOT NULL,
PRIMARY KEY (`user`)
)
ENGINE ='MEMORY'
COLLATE 'utf8_general_ci';
CREATE TABLE `stats_media` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`dt` DATETIME NOT NULL,
`media` VARCHAR(255) NOT NULL,
`ip` VARCHAR(40) DEFAULT NULL,
`ua` VARCHAR(255) NOT NULL,
`ua_info` VARCHAR(255) NOT NULL,
`ua_type` VARCHAR(32) NOT NULL,
`ua_ver` VARCHAR(10) NOT NULL,
`os` VARCHAR(32) NOT NULL,
`user` VARCHAR(255) NOT NULL,
`session` VARCHAR(255) NOT NULL,
`uid` VARCHAR(50) NOT NULL,
`size` INT UNSIGNED NOT NULL,
`mime1` VARCHAR(50) NOT NULL,
`mime2` VARCHAR(50) NOT NULL,
`inline` TINYINT(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `media` (`media`),
KEY `dt` (`dt`),
KEY `ua_type` (`ua_type`)
)
ENGINE ='MyISAM'
COLLATE ='utf8_unicode_ci';
ALTER TABLE `stats_media` ADD INDEX `mime1` (`mime1`);
CREATE TABLE `stats_history` (
`info` VARCHAR(50) NOT NULL,
`dt` DATE NOT NULL,
`value` INT UNSIGNED NOT NULL,
PRIMARY KEY (`info`, `dt`)
)
ENGINE ='MyISAM'
COLLATE ='utf8_unicode_ci';
CREATE TABLE `stats_groups` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`dt` DATETIME NOT NULL,
`group` VARCHAR(255) NOT NULL,
`type` VARCHAR(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `dt` (`dt`),
KEY `type` (`type`)
)
ENGINE ='MyISAM'
COLLATE ='utf8_unicode_ci';