aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/6.0.25_step_4253.php
blob: 0a89f14579c52db357ab205acb91d38f383bdb67 (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
<?php
return new class extends Migration {

    public function description()
    {
        return 'Adds column and configuration option for actual number of participants';
    }

    protected function up()
    {
        $db = DBManager::get();
        $db->exec("INSERT IGNORE INTO `config`
             (`field`, `value`, `type`, `range`, `section`, `mkdate`, `chdate`, `description`)
             VALUES
             (
              'ENABLE_NUMBER_OF_PARTICIPANTS',
              0,
              'bool',
              'global',
              'global',
              UNIX_TIMESTAMP(),
              UNIX_TIMESTAMP(),
              'Schaltet die Möglichkeit zum Erfassen der tatsächlichen Teilnehmendenzahl pro Termin ein.'
             )"
        );
        $db->exec("ALTER TABLE `termine` ADD `number_of_participants` SMALLINT NULL DEFAULT NULL");
    }

    protected function down()
    {
        $db = DBManager::get();
        $db->exec("DELETE `config`, `config_values`
                   FROM `config` LEFT JOIN `config_values` USING (`field`)
                   WHERE `field` = 'ENABLE_NUMBER_OF_PARTICIPANTS'");
        $db->exec("ALTER TABLE `termine` DROP `number_of_participants`");

    }
};