-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sql
70 lines (69 loc) · 2.25 KB
/
install.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
CREATE TABLE `class` (
`class_id` INT(11) NOT NULL AUTO_INCREMENT,
`title` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`detail` VARCHAR(500) NOT NULL COLLATE 'utf8mb4_general_ci',
`date` DATE NOT NULL,
`start_select` TIMESTAMP NOT NULL,
`end_select` TIMESTAMP NOT NULL,
PRIMARY KEY (`class_id`)
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;
CREATE TABLE `log` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`student_id` VARCHAR(10) NOT NULL COLLATE 'utf8mb4_general_ci',
`operation` VARCHAR(20) NOT NULL COLLATE 'utf8mb4_general_ci',
`ip` VARCHAR(50) NOT NULL COMMENT 'v6/v4都可以' COLLATE 'utf8mb4_general_ci',
`result` VARCHAR(20) NOT NULL COMMENT 'OK/FAILED' COLLATE 'utf8mb4_general_ci',
`payload` VARCHAR(500) NOT NULL COLLATE 'utf8mb4_general_ci',
PRIMARY KEY (`id`)
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=2
;
CREATE TABLE `selected_class` (
`student_id` VARCHAR(10) NOT NULL COLLATE 'utf8mb4_general_ci',
`subclass_id` INT(11) NOT NULL,
`select_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
UNIQUE INDEX `索引 1` (`student_id`, `subclass_id`)
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;
CREATE TABLE `subclass` (
`subclass_id` INT(11) NOT NULL AUTO_INCREMENT,
`class_id` INT(11) NOT NULL,
`title` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`capacity` INT(11) NOT NULL DEFAULT '0',
`start_time` TIMESTAMP NOT NULL,
`end_time` TIMESTAMP NOT NULL,
PRIMARY KEY (`subclass_id`)
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;
CREATE TABLE `user` (
`student_id` VARCHAR(10) NOT NULL COLLATE 'utf8mb4_general_ci',
`name` VARCHAR(30) NOT NULL COLLATE 'utf8mb4_general_ci',
`department` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`email` VARCHAR(100) NOT NULL COLLATE 'utf8mb4_general_ci',
`password` VARCHAR(100) NOT NULL COLLATE 'utf8mb4_general_ci',
`photo` VARCHAR(100) NOT NULL COLLATE 'utf8mb4_general_ci',
`verified` TINYINT(4) NOT NULL DEFAULT '0',
`is_admin` TINYINT(4) NOT NULL DEFAULT '0',
`insert_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`student_id`)
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;
CREATE TABLE `stream` (
`class_id` INT(11) NOT NULL,
`path` VARCHAR(100) NOT NULL COLLATE 'utf8mb4_general_ci',
PRIMARY KEY (`class_id`)
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;