aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.189_step_00288_sem_class_raumzeit.php
blob: 457a7e522de1f25a9ef604e96cc8592ed94c5f35 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
 * Migration for StEP00288
 *
 * @author  Timo Hartge <hartge@data-quest.de>
 * @license GPL2 or any later version
 * @since   Stud.IP 3.4
 *
 * @see https://develop.studip.de/trac/ticket/5797
 */
class Step00288SemClassRaumzeit extends Migration
{

    /**
     * short description of this migration
     */
    public function description()
    {
        return 'Registers new sem_class settings for display of raumzeit.';
    }

    /**
     * perform this migration
     */
    public function up()
    {        
        DBManager::get()->exec('ALTER TABLE `sem_classes` ADD `show_raumzeit` TINYINT( 4 ) NOT NULL DEFAULT "1" AFTER `title_autor_plural`');
                
        try { 
            $sem_class = new SemClass(99);
            $sem_class->set('show_raumzeit', '0');
            $sem_class->set('schedule', 'CoreSchedule');
            $modules = $sem_class->getModules();
            $modules['CoreSchedule'] = ['activated' => '1', 'sticky' => '0'];
            $sem_class->setModules($modules);
            $sem_class->store();
        } catch (Exception $e) { }
                
    }

    /**
     * revert this migration
     */
    public function down()
    {
        DBManager::get()->execute('ALTER TABLE `sem_classes` DROP `show_raumzeit`');
    }

}