aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.152_tic_5117_course_member_admission.php
blob: e7291358e70845fc6e00e1a06176445cdaf71888 (plain)
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
<?php
/**
 * Adds admission rule CourseMemberAdmission
 */
class Tic5117CourseMemberAdmission extends Migration
{
    function description()
    {
        return 'Adds admission rule CourseMemberAdmission';
    }

    function up()
    {
        DBManager::get()->exec("
            CREATE TABLE IF NOT EXISTS `coursememberadmissions` (
              `rule_id` varchar(32),
              `message` text NOT NULL,
              `start_time` int(11) NOT NULL DEFAULT 0,
              `end_time` int(11) NOT NULL DEFAULT 0,
              `course_id` varchar(32) NOT NULL DEFAULT '',
              `modus` tinyint(1) NOT NULL DEFAULT 0,
              `mkdate` int(11) NOT NULL DEFAULT 0,
              `chdate` int(11) NOT NULL DEFAULT 0,
              PRIMARY KEY (`rule_id`)
            ) ENGINE=MyISAM
        ");
        DBManager::get()->exec("INSERT IGNORE INTO `admissionrules` (`id`, `ruletype`, `active`, `mkdate`)
                                VALUES (NULL, 'CourseMemberAdmission', '1', UNIX_TIMESTAMP())");
    }

    function down()
    {
        DBManager::get()->exec("DROP TABLE `coursememberadmissions`");
        DBManager::get()->exec("DELETE FROM `admissionrules` WHERE `ruletype` = 'CourseMemberAdmission'");
    }
}