-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdatabase.sql
More file actions
39 lines (33 loc) · 1 KB
/
database.sql
File metadata and controls
39 lines (33 loc) · 1 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
drop table if exists `user`;
create table `user`(
`uid` int primary key auto_increment,
`email` varchar(100) unique not null,
`nickname` varchar(20) unique not null,
`password` char(64) not null
)charset=utf8;
drop table if exists `challenge`;
create table `challenge`(
`cid` int primary key auto_increment,
`name` varchar(100) not null,
`content` Text,
`file` varchar(1000) not null,
`flag` varchar(1000) not null
)charset=utf8;
drop table if exists `solved`;
create table `solved`(
`sid` int primary key auto_increment,
`uid` int not null,
`cid` int not null,
`time` char(20) not null,
foreign key(`uid`) REFERENCES `user`(`uid`),
foreign key(`cid`) REFERENCES `challenge`(`cid`),
unique(`uid`, `cid`)
)charset=utf8;
drop table if exists `writeups`;
create table `writeups`(
`wid` int primary key auto_increment,
`sid` int not null,
`writeup` TEXT,
`time` char(20) not null,
foreign key(`sid`) REFERENCES `solved`(`sid`)
)charset=utf8;