aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.258_tic7443_create_lvgruppen_independently.php
blob: 434a68b4c6e2061df8919e01553ea99988c85c05 (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
<?php
class Tic7443CreateLvgruppenIndependently extends Migration
{
    public function description()
    {
        return 'add config switch to allow creation of lvgruppen independently';
    }

    public function up()
    {
        $config_data = [
            'name'        => 'MVV_ALLOW_CREATE_LVGRUPPEN_INDEPENDENTLY',
            'range'       => 'global',
            'type'        => 'boolean',
            'description' => 'Soll das Anlegen von LV-Gruppen unabhängig von bestehenden Modulteilen auf der Verwaltungsseite für LV-Gruppen möglich sein?',
            'value'       => 0
        ];

        $stmt = DBManager::get()->prepare("
            REPLACE INTO config
            (field, value, `type`, `range`, mkdate, chdate, description)
            VALUES
            (:name, :value, :type, :range, UNIX_TIMESTAMP(),  UNIX_TIMESTAMP(), :description)
        ");

        $stmt->execute($config_data);
    }

    public function down()
    {
        DBManager::get()->exec("DELETE FROM config WHERE field = 'MVV_ALLOW_CREATE_LVGRUPPEN_INDEPENDENTLY'");
        DBManager::get()->exec("DELETE FROM config_values WHERE field = 'MVV_ALLOW_CREATE_LVGRUPPEN_INDEPENDENTLY'");
    }
}