aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.85_tic2007_schedule_enable.php
blob: 7654be356eb92c1fcabae503ffe412871b434b32 (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
<?php

class Tic2007ScheduleEnable extends Migration
{
    /**
     * short description of this migration
     */
    function description()
    {
        return 'adds global configuration to disable/enable the schedule';
    }

    /**
     * perform this migration
     */
    function up()
    {
        $db = DBManager::get();
        $time = time();

        $stmt = $db->prepare("
                INSERT INTO config
                    (config_id, field, value, is_default, type, `range`, section, mkdate, chdate, description)
                VALUES
                    (MD5(:name), :name, :value, 1, :type, :range, :section, $time, $time, :description)
                ");

        $stmt->execute([
            'name' => 'SCHEDULE_ENABLE',
            'description' => 'Schaltet ein oder aus, ob der Stundenplan global verfügbar ist.',
            'section' => 'modules',
            'range' => 'global',
            'type' => 'boolean',
            'value' => '1'
        ]);
    }

    /**
     * revert this migration
     */
    function down()
    {
        $db = DBManager::get();
        $db->exec("DELETE FROM config WHERE field = 'SCHEDULE_ENABLE'");
    }
}