aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/6.0.26_add_customized_holidays_configuration.php
blob: cb21301a7a77c1c921d0edda174f6f910a31e21b (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
<?php

/**
 * @see https://gitlab.studip.de/studip/studip/-/issues/2795
 */
final class AddCustomizedHolidaysConfiguration extends Migration
{
    public function description()
    {
        return 'Adds a confiugration for customized holidays';
    }

    protected function up()
    {
        $query = "INSERT INTO `config` (
                      `field`, `value`, `type`, `range`, `section`,
                      `mkdate`, `chdate`,
                      `description`
                  ) VALUES (
                      'CUSTOMIZED_HOLIDAYS', '[]', 'array', 'global', 'global',
                      UNIX_TIMESTAMP(), UNIX_TIMESTAMP(),
                      'Speichert die internen Ids von Feiertagen, die als gesetztlich markiert werden sollen'
                  )";
        DBManager::get()->exec($query);
    }

    protected function down()
    {
        $query = "DELETE `config`, `config_values`
                  FROM `config`
                  LEFT JOIN `config_values` USING (`field`)
                  WHERE `field` = 'CUSTOMIZED_HOLIDAYS'";
        DBManager::get()->exec($query);
    }
}