-
Notifications
You must be signed in to change notification settings - Fork 8
/
db_changes.txt
608 lines (484 loc) · 21.5 KB
/
db_changes.txt
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
CREATE TABLE `batches` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL COLLATE 'latin1_swedish_ci',
`description` VARCHAR(255) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
PRIMARY KEY (`id`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
-----------------------------------------------------------------------------------------------------------------
CREATE TABLE `batches_users` (
`user_id` INT(11) UNSIGNED NOT NULL,
`batch_id` INT(11) UNSIGNED NOT NULL,
PRIMARY KEY (`user_id`, `batch_id`),
INDEX `batch_id` (`batch_id`),
CONSTRAINT `FK_batches_users_batches` FOREIGN KEY (`batch_id`) REFERENCES `batches` (`id`) ON DELETE CASCADE,
CONSTRAINT `FK_batches_users_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
------------------------------------------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `locations` (
`id` int(100) NOT NULL AUTO_INCREMENT,
`name` varchar(200) CHARACTER SET latin1 NOT NULL,
`image` varchar(200) CHARACTER SET latin1 NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-------------------------------------------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `rooms` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`location_id` int(11) NOT NULL,
`room_number` varchar(100) CHARACTER SET latin1 NOT NULL,
`room_name` varchar(200) CHARACTER SET latin1 NOT NULL,
PRIMARY KEY (`id`),
KEY `locations` (`location_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
ALTER TABLE `rooms`
ADD CONSTRAINT `rooms_ibfk_1` FOREIGN KEY (`location_id`) REFERENCES `locations` (`id`) ON DELETE CASCADE;
------------------------------------------------------------------------------------------------------------------
ALTER TABLE `users`
ADD COLUMN `avatar` VARCHAR(255) NULL DEFAULT NULL AFTER `last_login`;
----------------------------------------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `courses` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`description` varchar(255) DEFAULT NULL,
`access_code` varchar(50) DEFAULT NULL,
`start_date` date NOT NULL,
`end_date` date NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
CREATE TABLE `courses_users` (
`user_id` INT(11) UNSIGNED NOT NULL,
`course_id` INT(11) UNSIGNED NOT NULL,
PRIMARY KEY (`user_id`, `course_id`),
INDEX `course_id` (`course_id`),
CONSTRAINT `FK_courses_users_courses` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE,
CONSTRAINT `FK_courses_users_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
------------------------------------------------------------------------------------------------------------------
ALTER TABLE `roles`
ADD COLUMN `permissions` TEXT NOT NULL AFTER `description`
-------------------------------------------------------------------------------------------------------------------
--
-- Table structure for table `institutions`
--
CREATE TABLE IF NOT EXISTS `institutions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(128) NOT NULL,
`institution_type_id` int(11) NOT NULL,
`logo` varchar(255) NOT NULL,
`address` text NOT NULL,
`website` varchar(128) NOT NULL,
`last_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `institutions`
--
-- --------------------------------------------------------
--
-- Table structure for table `institutiontypes`
--
CREATE TABLE IF NOT EXISTS `institutiontypes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
--
-- Dumping data for table `institutiontypes`
--
INSERT INTO `institutiontypes` (`id`, `name`) VALUES
(1, 'High School'),
(2, 'Junior College'),
(3, 'Professional Institution'),
(4, 'Coaching Class'),
(5, 'B-School');
-- --------------------------------------------------------
--
-- Table structure for table `setting`
--
CREATE TABLE IF NOT EXISTS `setting` (
`setting_id` int(11) NOT NULL AUTO_INCREMENT,
`group_name` varchar(255) NOT NULL,
`config_key` varchar(128) NOT NULL,
`config_value` varchar(255) NOT NULL,
PRIMARY KEY (`setting_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
-----------------------------------------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `events` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`eventtype` enum('exam','lecture') NOT NULL,
`eventstart` varchar(15) NOT NULL,
`eventend` varchar(15) NOT NULL,
`room_id` int(10) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_events_rooms` (`room_id`)
) ENGINE=InnoDB ;
-----------------------------------------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `examgroups` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) CHARACTER SET latin1 DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
-----------------------------------------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `exams` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`examgroup_id` int(10) unsigned NOT NULL,
`event_id` int(10) unsigned NOT NULL,
`course_id` int(10) unsigned NOT NULL,
`total_marks` int(10) unsigned NOT NULL,
`passing_marks` int(10) unsigned NOT NULL,
`reminder` enum('1','0') NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `FK_exams_examgroups` (`examgroup_id`),
KEY `FK_exams_events` (`event_id`),
KEY `FK_exams_courses` (`course_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
----------------------------------------------------------------------------------------------------------------
ALTER TABLE `users` ADD `status` TINYINT( 1 ) NOT NULL DEFAULT '1'
----------------------------------------------------------------------------------------------------------------
ALTER TABLE `users` ADD `parent_user_id` INT NOT NULL DEFAULT '0'
----------------------------------------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `examresults` (
`exam_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`marks` float NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
------------------------------------------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `attendences` (
`event_id` int(20) NOT NULL,
`user_id` int(20) NOT NULL,
`present` tinyint(1) NOT NULL,
KEY `event_id` (`event_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-----------------------------------------------------------------------------------------------------------------
ALTER TABLE `users`
ADD COLUMN `forgot_password_string`varchar(200) NULL DEFAULT NULL AFTER `avatar`;
------------------------------------------------------------------------------------------------------------------
ALTER TABLE `users`
ADD COLUMN `about_me`varchar(256) NULL DEFAULT '' AFTER `password`;
----------------------------------------Lectures------------------------------------------------------------------
CREATE TABLE `lectures` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) NOT NULL DEFAULT '' COLLATE 'latin1_swedish_ci',
`course_id` INT(11) UNSIGNED NOT NULL,
`user_id` INT(11) UNSIGNED NOT NULL,
`room_id` INT(11) UNSIGNED NOT NULL,
`type` ENUM('once','repeat') NOT NULL DEFAULT 'once' COLLATE 'latin1_swedish_ci',
`when` VARCHAR(255) NOT NULL COMMENT 'It will sotre the unserialized array of the days of the lecture with time if the lecture is repeating',
`start_date` VARCHAR(15) NOT NULL,
`end_date` VARCHAR(15) NOT NULL,
PRIMARY KEY (`id`),
INDEX `FK_lectures_courses` (`course_id`),
CONSTRAINT `FK_lectures_courses` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
CREATE TABLE `lectures_events` (
`lecture_id` INT(11) UNSIGNED NOT NULL,
`event_id` INT(11) UNSIGNED NOT NULL,
INDEX `FK_lectures_events_lectures` (`lecture_id`),
INDEX `FK_lectures_events_events` (`event_id`),
CONSTRAINT `FK_lectures_events_events` FOREIGN KEY (`event_id`) REFERENCES `events` (`id`) ON DELETE CASCADE,
CONSTRAINT `FK_lectures_events_lectures` FOREIGN KEY (`lecture_id`) REFERENCES `lectures` (`id`) ON DELETE CASCADE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
-----------------------------------------------------------------------------------------------------------------------
ALTER TABLE `events`
ADD COLUMN `course_id` INT NOT NULL DEFAULT 0 AFTER `room_id`
-----------------------------------------------------------------------------------------------------------------------
RENAME TABLE `attendences` TO `attendances` ;
-----------------------------------------------------------------------------------------------------------------------
ALTER TABLE `events`
ADD COLUMN `cancel` INT NOT NULL DEFAULT 0 AFTER `course_id`
-----------------------------------------------------------------------------------------------------------------------
CREATE TABLE `feeds` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`type` VARCHAR(50) NOT NULL DEFAULT '',
`action` VARCHAR(50) NOT NULL DEFAULT '',
`respective_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`course_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
`actor_id` INT(11) UNSIGNED NOT NULL,
`time` VARCHAR(15) NOT NULL,
PRIMARY KEY (`id`),
INDEX `FK_feed_courses` (`course_id`),
INDEX `FK_feed_users` (`actor_id`),
CONSTRAINT `FK_feed_users` FOREIGN KEY (`actor_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
CREATE TABLE `feeds_users` (
`feed_id` INT(11) UNSIGNED NOT NULL,
`user_id` INT(11) UNSIGNED NOT NULL,
INDEX `FK_feed_users_feed` (`feed_id`),
INDEX `FK_feed_users_users` (`user_id`),
CONSTRAINT `FK_feed_users_feed` FOREIGN KEY (`feed_id`) REFERENCES `feeds` (`id`) ON DELETE CASCADE,
CONSTRAINT `FK_feed_users_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;
--------------------------------------------------------------------------------------------------------------------------
ALTER TABLE `examgroups`
ADD COLUMN `publish` TINYINT NOT NULL DEFAULT '0' AFTER `name`;
--------------------------------------------------------------------------------------------------------------------------
--
-- Table structure for table `documents`
--
CREATE TABLE IF NOT EXISTS `documents` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) CHARACTER SET latin1 NOT NULL,
`name` varchar(255) CHARACTER SET latin1 NOT NULL,
`user_id` int(11) unsigned NOT NULL,
`time` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;
-- --------------------------------------------------------
--
-- Table structure for table `documents_roles`
--
CREATE TABLE IF NOT EXISTS `documents_roles` (
`role_id` int(11) unsigned NOT NULL,
`document_id` int(11) unsigned NOT NULL,
KEY `role_id` (`role_id`),
KEY `document_id` (`document_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `documents`
--
ALTER TABLE `documents`
ADD CONSTRAINT `documents_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE;
--
-- Constraints for table `documents_roles`
--
ALTER TABLE `documents_roles`
ADD CONSTRAINT `documents_roles_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON UPDATE CASCADE,
ADD CONSTRAINT `documents_roles_ibfk_2` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON UPDATE CASCADE;
CREATE TABLE IF NOT EXISTS `documents_courses` (
`course_id` int(11) unsigned NOT NULL,
`document_id` int(11) unsigned NOT NULL,
KEY `course_id` (`course_id`),
KEY `document_id` (`document_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `documents_courses`
ADD CONSTRAINT `documents_courses_ibfk_2` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `documents_courses_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE;
----------------------------------------------------------------
ALTER TABLE `exams` ADD `reminder_days` INT( 10 ) NOT NULL
------------------------------------------------------------------
CREATE TABLE `kodelearn`.`reminders` (
`id` INT( 100 ) NOT NULL ,
`date` VARCHAR( 15 ) NOT NULL ,
`sent` TINYINT( 1 ) NOT NULL
) ENGINE = MYISAM ;
--------------------------------------------------------------------
DROP TABLE `feeds_users`;
--------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `feedstreams` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL DEFAULT '0',
`role_id` int(11) NOT NULL DEFAULT '0',
`course_id` int(11) NOT NULL DEFAULT '0',
`batch_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `idk_unique_combination` (`id`,`user_id`,`role_id`,`course_id`,`batch_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
--------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `feeds_feedstreams` (
`feed_id` int(11) unsigned NOT NULL,
`feedstream_id` int(11) NOT NULL,
KEY `feedstream_id` (`feedstream_id`),
KEY `feed_id` (`feed_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `feeds_feedstreams`
ADD CONSTRAINT `feeds_feedstreams_ibfk_1` FOREIGN KEY (`feedstream_id`) REFERENCES `feedstreams` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `feeds_feedstreams_ibfk_2` FOREIGN KEY (`feed_id`) REFERENCES `feeds` (`id`) ON DELETE CASCADE;
--------------------------------------------------------------------
--
-- Table structure for table `questions`
--
CREATE TABLE IF NOT EXISTS `questions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`question` text NOT NULL,
`extra` varchar(255) NOT NULL,
`type` enum('choice','grouped','matching','open','ordering') NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`user_id` int(11) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `parent_id` (`parent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
--
-- Table structure for table `questionattributes`
--
CREATE TABLE IF NOT EXISTS `questionattributes` (
`question_id` int(11) NOT NULL,
`attribute_name` varchar(32) NOT NULL,
`attribute_value` text NOT NULL,
`explanation` text NOT NULL,
`correctness` tinyint(1) NOT NULL,
KEY `question_id` (`question_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `questionhints`
--
CREATE TABLE IF NOT EXISTS `questionhints` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`question_id` int(11) NOT NULL,
`hint` text NOT NULL,
`deduction` float NOT NULL,
`sort_order` tinyint(4) NOT NULL,
PRIMARY KEY (`id`),
KEY `question_id` (`question_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
--
-- Constraints for table `questionattributes`
--
ALTER TABLE `questionattributes`
ADD CONSTRAINT `questionattributes_ibfk_1` FOREIGN KEY (`question_id`) REFERENCES `questions` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `questionhints`
--
ALTER TABLE `questionhints`
ADD CONSTRAINT `questionhints_ibfk_1` FOREIGN KEY (`question_id`) REFERENCES `questions` (`id`);
--
-- Constraints for table `questions`
--
ALTER TABLE `questions`
ADD CONSTRAINT `questions_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `questions` (`id`);
ALTER TABLE `questions` ADD COLUMN `course_id` int(11) unsigned NOT NULL AFTER `user_id`
ALTER TABLE `questions
ADD CONSTRAINT `questions_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`);
-----------------------------------------------------
CREATE TABLE IF NOT EXISTS `flashcards` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`description` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
CREATE TABLE IF NOT EXISTS `flashcards_questions` (
`flashcard_id` int(11) NOT NULL,
`question_id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
------------------------------------------------------
--
-- Table structure for table `exercisequestions`
--
CREATE TABLE IF NOT EXISTS `exercisequestions` (
`exercise_id` int(11) NOT NULL,
`question_id` int(11) NOT NULL,
`marks` int(11) NOT NULL,
KEY `exercise_id` (`exercise_id`),
KEY `question_id` (`question_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `exerciseresults`
--
CREATE TABLE IF NOT EXISTS `exerciseresults` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`exercise_id` int(11) NOT NULL,
`user_id` int(11) unsigned NOT NULL,
`score` decimal(5,2) NOT NULL,
`attempted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`session_data` text NOT NULL,
PRIMARY KEY (`id`),
KEY `exercise_id` (`exercise_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `exercises`
--
CREATE TABLE IF NOT EXISTS `exercises` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`slug` varchar(128) NOT NULL,
`description` text NOT NULL,
`format` enum('quiz','test') NOT NULL,
`pub_status` tinyint(1) NOT NULL,
`course_id` tinyint(4) NOT NULL,
`session_resumable` tinyint(4) NOT NULL,
`time_minutes` int(11) NOT NULL DEFAULT '0',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`modified_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `exercisequestions`
--
ALTER TABLE `exercisequestions`
ADD CONSTRAINT `exercisequestions_ibfk_1` FOREIGN KEY (`exercise_id`) REFERENCES `exercises` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `exercisequestions_ibfk_2` FOREIGN KEY (`question_id`) REFERENCES `questions` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `exerciseresults`
--
ALTER TABLE `exerciseresults`
ADD CONSTRAINT `exerciseresults_ibfk_1` FOREIGN KEY (`exercise_id`) REFERENCES `exercises` (`id`),
ADD CONSTRAINT `exerciseresults_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
-- for adding the new role studentmoderator
INSERT INTO `roles` (`id`, `name`, `description`, `permissions`) VALUES
(6, 'studentmoderator', 'restricted', 'a:30:{s:12:"account_view";s:1:"1";s:15:"assignment_view";s:1:"1";s:17:"assignment_create";s:1:"1";s:15:"assignment_edit";s:1:"1";s:17:"assignment_delete";s:1:"1";s:15:"attendance_view";s:1:"1";s:10:"batch_view";s:1:"1";s:13:"calendar_view";s:1:"1";s:11:"course_view";s:1:"1";s:11:"course_join";s:1:"1";s:13:"document_view";s:1:"1";s:17:"document_download";s:1:"1";s:10:"event_view";s:1:"1";s:9:"exam_view";s:1:"1";s:14:"examgroup_view";s:1:"1";s:18:"exammarksheet_view";s:1:"1";s:15:"examresult_view";s:1:"1";s:13:"exercise_view";s:1:"1";s:16:"exercise_attempt";s:1:"1";s:9:"feed_view";s:1:"1";s:14:"flashcard_view";s:1:"1";s:12:"lecture_view";s:1:"1";s:11:"lesson_view";s:1:"1";s:13:"location_view";s:1:"1";s:9:"post_view";s:1:"1";s:11:"post_create";s:1:"1";s:9:"post_edit";s:1:"1";s:11:"post_delete";s:1:"1";s:13:"question_view";s:1:"1";s:9:"room_view";s:1:"1";}');
--for comments
CREATE TABLE IF NOT EXISTS `feedcomments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`comment` varchar(255) NOT NULL,
`feed_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`date` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=116 ;
CREATE TABLE IF NOT EXISTS `post_meta` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`post_id` int(11) NOT NULL,
`key` varchar(255) NOT NULL,
`value` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=93 ;
CREATE TABLE IF NOT EXISTS `links` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`image` varchar(255) NOT NULL,
`url` varchar(255) NOT NULL,
`course_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ;
CREATE TABLE IF NOT EXISTS `videos` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`course_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;
--
-- Table structure for table `noticesettings`
--
CREATE TABLE IF NOT EXISTS `noticesettings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`institution_id` int(11) NOT NULL,
`status` tinyint(1) NOT NULL,
`sender_email` varchar(128) NOT NULL,
`preferences` text NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `institution_id` (`institution_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `noticesettings`
--
ALTER TABLE `noticesettings`
ADD CONSTRAINT `noticesettings_ibfk_1` FOREIGN KEY (`institution_id`) REFERENCES `institutions` (`id`);