aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.244_config_default_seats.php
blob: 8d71185ea95636ff256e66087164be9993a99a8e (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
<?php

class ConfigDefaultSeats extends Migration
{
    public function description()
    {
        return 'add config option for RESOURCES_ROOM_REQUEST_DEFAULT_SEATS';
    }

    public function up()
    {
        $db = DBManager::get();

        $stmt = $db->prepare('INSERT INTO config (field, value, type, section, mkdate, chdate, description)
                              VALUES (:name, :value, :type, :section, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :description)');
        $stmt->execute([
            'name'        => 'RESOURCES_ROOM_REQUEST_DEFAULT_SEATS',
            'description' => 'Vorbelegung der Sitzplatzanzahl einer Raumanfrage, falls der Kurs keine max. Teilnehmerzahl hat',
            'section'     => 'resources',
            'type'        => 'integer',
            'value'       => '0'
        ]);
    }

    public function down()
    {
        $db = DBManager::get();

        $stmt = $db->prepare('DELETE config, config_values FROM config LEFT JOIN config_values USING(field) WHERE field = ?');
        $stmt->execute(['RESOURCES_ROOM_REQUEST_DEFAULT_SEATS']);
    }
}