forked from edusoho/edusoho
-
Notifications
You must be signed in to change notification settings - Fork 0
/
20161224134523_course_thread.php
32 lines (29 loc) · 1.03 KB
/
20161224134523_course_thread.php
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
<?php
use Phpmig\Migration\Migration;
class CourseThread extends Migration
{
/**
* Do the migration.
*/
public function up()
{
$biz = $this->getContainer();
$biz['db']->exec("
ALTER TABLE `course_thread` ADD courseSetId INT(10) UNSIGNED NOT NULL;
ALTER TABLE `course_thread` CHANGE `lessonId` `taskId` INT(10) unsigned NOT NULL DEFAULT '0' COMMENT '任务ID';
ALTER TABLE `course_thread_post` CHANGE `lessonId` `taskId` INT(10) unsigned NOT NULL DEFAULT '0' COMMENT '任务ID';
");
}
/**
* Undo the migration.
*/
public function down()
{
$biz = $this->getContainer();
$biz['db']->exec("
ALTER TABLE `course_thread` DROP COLUMN courseSetId;
ALTER TABLE `course_thread` CHANGE `taskId` `lessonId` INT(10) unsigned NOT NULL DEFAULT '0' COMMENT '课时ID';
ALTER TABLE `course_thread_post` CHANGE `taskId` `lessonId` INT(10) unsigned NOT NULL DEFAULT '0' COMMENT '课时ID';
");
}
}