-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.sql
237 lines (213 loc) · 9.12 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Struktur von Tabelle superlearn.answers
CREATE TABLE IF NOT EXISTS `answers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`correct` tinyint(1) NOT NULL DEFAULT '0',
`text` varchar(50) NULL DEFAULT NULL,
`question_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `question_id` (`question_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.app
CREATE TABLE IF NOT EXISTS `app` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`token` varchar(32) NOT NULL,
`text` varchar(50) NOT NULL,
`valid` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE INDEX `token` (`token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.logins
CREATE TABLE IF NOT EXISTS `logins` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`device_id` varchar(50) NOT NULL,
`token` varchar(250) NOT NULL,
`expires` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.medals
CREATE TABLE IF NOT EXISTS `medals` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`text` varchar(150) NOT NULL,
`bronze` int(10) unsigned NOT NULL,
`silver` int(10) unsigned NOT NULL,
`gold` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.modules
CREATE TABLE IF NOT EXISTS `modules` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`short` varchar(4) NOT NULL,
`long` varchar(150) NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.modules_user_rel
CREATE TABLE IF NOT EXISTS `modules_user_rel` (
`module_id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned NOT NULL,
`status` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0:default 1:fav 2:passed',
`level` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`exp` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`reached_milestones` INT(10) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`module_id`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.pwd_resets
CREATE TABLE IF NOT EXISTS `pwd_resets` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL,
`reset_token` varchar(250) NOT NULL,
`destination` varchar(150) NOT NULL,
`expires` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.questions
CREATE TABLE IF NOT EXISTS `questions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`text` varchar(250) NOT NULL,
`image` varchar(150) DEFAULT NULL,
`score` int(11) NOT NULL DEFAULT '0',
`question_type_id` int(10) unsigned NOT NULL COMMENT '1:boolean, 2:four, 3:exact',
`module_id` int(10) unsigned NOT NULL,
`deleted` tinyint(1) unsigned NOT NULL DEFAULT '0',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`user_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `question_type_id` (`question_type_id`),
KEY `module_id` (`module_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.questions_question_tags_rel
CREATE TABLE IF NOT EXISTS `questions_question_tags_rel` (
`question_id` int(10) unsigned NOT NULL,
`question_tag_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`question_id`,`question_tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.question_tags
CREATE TABLE IF NOT EXISTS `question_tags` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`text` varchar(50) NOT NULL,
`user_id` int(10) unsigned NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.reports
CREATE TABLE IF NOT EXISTS `reports` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`report_type_id` int(10) unsigned NOT NULL COMMENT '1:offensive, 2:duplicate, 3:spelling, 4:troll, 5:other',
`text` varchar(250) NOT NULL,
`processed` tinyint(1) unsigned NOT NULL DEFAULT '0',
`question_id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `report_type_id` (`report_type_id`),
KEY `question_id` (`question_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.rounds
CREATE TABLE IF NOT EXISTS `rounds` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`module_id` int(11) DEFAULT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`state` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `module_id` (`module_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.solutions
CREATE TABLE IF NOT EXISTS `solutions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`text` varchar(150) NOT NULL,
`image` varchar(150) DEFAULT NULL,
`question_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `question_id` (`question_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.studies_courses
CREATE TABLE IF NOT EXISTS `studies_courses` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`text` varchar(150) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.studies_courses_modules_rel
CREATE TABLE IF NOT EXISTS `studies_courses_modules_rel` (
`studies_course_id` int(10) unsigned NOT NULL,
`semester` tinyint(3) unsigned DEFAULT '1',
`module_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`studies_course_id`,`module_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.user
CREATE TABLE IF NOT EXISTS `user` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`email` varchar(150) NOT NULL,
`nickname` varchar(50) NOT NULL,
`password` varchar(60) NOT NULL,
`image` varchar(150) DEFAULT NULL,
`score` int(11) NOT NULL DEFAULT '0',
`rank_id` int(10) unsigned NOT NULL COMMENT '1:student, 2:admin, 3:prof, 4:lecturer',
`confirmed` tinyint(3) unsigned NOT NULL DEFAULT '0',
`banned` tinyint(3) unsigned NOT NULL DEFAULT '0',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `rank_id` (`rank_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.user_medals_rel
CREATE TABLE IF NOT EXISTS `user_medals_rel` (
`user_id` int(10) unsigned NOT NULL,
`medal_id` int(10) unsigned NOT NULL,
`value` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`user_id`,`medal_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.user_questions_rel
CREATE TABLE IF NOT EXISTS `user_questions_rel` (
`user_id` int(10) unsigned NOT NULL,
`question_id` int(10) unsigned NOT NULL,
`star_counter` int(10) unsigned NOT NULL DEFAULT '0',
`max_star_counter` int(10) unsigned NOT NULL DEFAULT '0',
`answered_counter` int(10) unsigned NOT NULL DEFAULT '0',
`wrong_counter` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`user_id`,`question_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.user_studies_courses_rel
CREATE TABLE IF NOT EXISTS `user_studies_courses_rel` (
`user_id` int(10) unsigned NOT NULL,
`studies_course_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`user_id`,`studies_course_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.votings
CREATE TABLE IF NOT EXISTS `votings` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned DEFAULT NULL,
`score` tinyint(4) DEFAULT NULL,
`timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.votings_questions_rel
CREATE TABLE IF NOT EXISTS `votings_questions_rel` (
`voting_id` int(10) unsigned NOT NULL,
`question_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`voting_id`,`question_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Struktur von Tabelle superlearn.votings_user_rel
CREATE TABLE IF NOT EXISTS `votings_user_rel` (
`voting_id` int(10) unsigned NOT NULL,
`user_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`voting_id`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;