forked from TehFishey/tfo-peer-review
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dbsetup.sql
87 lines (75 loc) · 2.25 KB
/
dbsetup.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
--db
CREATE DATABASE tfopeerreview_db;
--user
GRANT ALL ON tfopeerreview_db.*
TO 'tfopeerreview_user'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
--tables
use tfopeerreview_db;
--creatures
CREATE TABLE `Creatures` (
`code` varchar(5) PRIMARY KEY NOT NULL,
`imgSrc` varchar(60) NOT NULL,
`gotten` varchar(10) NOT NULL,
`growthLevel` varchar(1) NOT NULL,
`isStunted` varchar(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--flags
CREATE TABLE `FlaggedCodes` (
`uuid` varchar(36) NOT NULL,
`code` varchar(5) NOT NULL,
PRIMARY KEY(uuid, code)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--clicks
CREATE TABLE `Clicks` (
`uuid` varchar(36) NOT NULL,
`code` varchar(5) NOT NULL,
`time` varchar(10) NOT NULL,
PRIMARY KEY(uuid, code)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--sessions
CREATE TABLE `Sessions` (
`sessionId` int NOT NULL UNIQUE KEY AUTO_INCREMENT,
`ip` varchar(45) NOT NULL PRIMARY KEY,
`time` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--sessioncache
CREATE TABLE `SessionCache` (
`sessionId` int NOT NULL,
`code` varchar(5) NOT NULL,
`imgSrc` varchar(60) NOT NULL,
`gotten` varchar(10) NOT NULL,
`name` varchar(30) NOT NULL,
`growthLevel` varchar(1) NOT NULL,
`isStunted` varchar(5) NOT NULL,
PRIMARY KEY(sessionId, code)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--logs
CREATE TABLE `Log_Metrics` (
`weekId` varchar(7) PRIMARY KEY NOT NULL,
`uniques` int NOT NULL DEFAULT 0,
`clicks` int NOT NULL DEFAULT 0,
`curls` int NOT NULL DEFAULT 0,
`creatureAdds` int NOT NULL DEFAULT 0,
`creatureRemoves` int NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `Log_Labs` (
`weekId` varchar(7) NOT NULL,
`labname` varchar(20) NOT NULL,
PRIMARY KEY(weekId, labname)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `Log_Creatures` (
`weekId` varchar(7) NOT NULL,
`code` varchar(5) NOT NULL,
PRIMARY KEY(weekId, code)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `Log_Uniques` (
`weekId` varchar(7) NOT NULL,
`ip` varchar(45) NOT NULL,
PRIMARY KEY(weekId, ip)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--rate limiter logs
CREATE TABLE `RateLimits` (
`ip` varchar(45) PRIMARY KEY NOT NULL,
`microtime` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;