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
|
<?php
class AddCoursewareStructuralElementDiscussion extends \Migration
{
public function description()
{
return 'Create Courseware structural element database tables for discussions';
}
public function up()
{
$db = \DBManager::get();
$db->exec("CREATE TABLE `cw_structural_element_comments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`structural_element_id` int(11) NOT NULL,
`user_id` char(32) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`comment` MEDIUMTEXT NOT NULL,
`mkdate` int(11) NOT NULL,
`chdate` int(11) NOT NULL,
PRIMARY KEY (`id`),
INDEX index_structural_element_id (`structural_element_id`),
INDEX index_user_id (`user_id`)
)
");
$db->exec("CREATE TABLE `cw_structural_element_feedbacks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`structural_element_id` int(11) NOT NULL,
`user_id` char(32) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`feedback` MEDIUMTEXT NOT NULL,
`mkdate` int(11) NOT NULL,
`chdate` int(11) NOT NULL,
PRIMARY KEY (`id`),
INDEX index_structural_element_id (`structural_element_id`),
INDEX index_user_id (`user_id`)
)
");
}
public function down()
{
$db = \DBManager::get();
$db->exec("DROP TABLE IF EXISTS `cw_structural_element_feedbacks`, `cw_structural_element_comments`");
}
}
|