-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_db.sql
More file actions
84 lines (70 loc) · 1.89 KB
/
create_db.sql
File metadata and controls
84 lines (70 loc) · 1.89 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
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
CREATE USER quiz@localhost IDENTIFIED BY 'password';
CREATE DATABASE quiz;
USE quiz;
CREATE TABLE `users` (
`userID` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(191) NOT NULL UNIQUE,
`courriel` varchar(255),
`password` varchar(64) NOT NULL,
`actif` int NOT NULL DEFAULT 1,
PRIMARY KEY (`userID`)
);
CREATE TABLE `theme` (
`themeID` int(11) NOT NULL AUTO_INCREMENT,
`lang` int,
`titre` varchar(255) NOT NULL,
`ordre` int,
`description` text,
PRIMARY KEY (`themeID`)
);
CREATE TABLE `serie` (
`serieID` int(11) NOT NULL AUTO_INCREMENT,
`themeID` int(11) NOT NULL,
`numero` int NOT NULL,
`titre` varchar(255) NOT NULL,
`description` text,
PRIMARY KEY (`serieID`)
);
CREATE TABLE `question` (
`questionID` int(11) NOT NULL AUTO_INCREMENT,
`type` int NOT NULL,
`serieID` int(11) NOT NULL,
`titre` varchar(255) NOT NULL,
`description` text,
`numero` int NOT NULL,
`enonce` text,
`points` int DEFAULT 0,
PRIMARY KEY (`questionID`)
);
CREATE TABLE `question_prog` (
`questionID` int(11) NOT NULL,
`lang` int,
`setup` text,
`pre_exec` text,
`pre_code` text,
`in_code` text,
`post_code` text,
`reponse` text,
`params` varchar(255),
`stdin` varchar(255),
PRIMARY KEY (`questionID`)
);
CREATE TABLE `question_systeme` (
`questionID` int(11) NOT NULL,
`image` varchar(255),
`user` varchar(32),
`verification` text,
`reponse` varchar(255),
PRIMARY KEY (`questionID`)
);
CREATE TABLE `avancement` (
`userID` int(11) NOT NULL,
`questionID` int(11) NOT NULL,
`etat` int DEFAULT 0,
`reponse` text,
PRIMARY KEY (`userID`, `questionID`)
);
/*Admin*/
GRANT ALL PRIVILEGES ON quiz.* TO quiz@localhost;
/*admin/admin*/
INSERT INTO users (userID, username, password) VALUES (99999, 'admin', '8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918');