-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.sql
77 lines (70 loc) · 2 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
drop database if exists userdata;
create database userdata
character set utf8;
use userdata;
create table user (
username varchar(50) not null,
password varchar(50) not null,
email varchar(50) not null,
type enum('user','admin') not null,
primary key (username),
index (type)
);
create table entry (
id int not null auto_increment,
user varchar(50) not null,
uploadDateTime datetime not null,
startedDateTime datetime not null,
wait int,
server_lat float,
server_lon float,
user_lat float,
user_lon float,
isp varchar(50) not null,
primary key (id),
constraint entry_user foreign key (user) references user(username) on delete cascade on update cascade,
index (user),
index (isp)
);
create table request (
id int not null auto_increment,
entry int not null,
method varchar(10) not null,
url varchar(2000) not null,
primary key (id),
constraint of_entry1 foreign key (entry) references entry(id) on delete cascade on update cascade,
index (method)
);
create table response (
id int not null auto_increment,
entry int not null,
status int,
status_text varchar(50),
primary key (id),
constraint of_entry2 foreign key (entry) references entry(id) on delete cascade on update cascade,
index (status)
);
create table header (
id int not null auto_increment,
request int,
response int,
content_type varchar(50),
pragma varchar(50),
expires datetime,
max_age int,
age int,
last_modified datetime,
host varchar(100),
primary key (id),
constraint of_response foreign key (response) references response(id) on delete cascade on update cascade,
constraint of_request foreign key (request) references request(id) on delete cascade on update cascade,
index (content_type)
);
create table cache_control (
header int not null,
control varchar(50) not null,
primary key (header,control),
constraint of_header foreign key (header) references header(id) on delete cascade on update cascade,
index (control)
);
insert into user values ('admin',MD5('1'),'[email protected]','admin');