aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/5.3.24_add_personal_notification_configurations.php
blob: b69756a95a0427cd7e802fec1e25f64200b0509e (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
final class AddPersonalNotificationConfigurations extends Migration
{
    public function description()
    {
        return 'Adds missing configurations for "PERSONAL_NOTIFICATIONS_DEACTIVATED" and "PERSONAL_NOTIFICATIONS_AUDIO_DEACTIVATED"';
    }

    protected function up()
    {
        $query = "INSERT IGNORE INTO `config`
                  (`field`, `value`, `type`, `range`, `mkdate`, `chdate`, `description`)
                  VALUES (:field, :value, 'boolean', 'user', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :description)";
        $statement = DBManager::get()->prepare($query);

        $statement->execute([
            ':field' => 'PERSONAL_NOTIFICATIONS_DEACTIVATED',
            ':value' => '0',
            ':description' => 'Deaktiviert die persönlichen Benachrichtigungen',
        ]);

        $statement->execute([
            ':field' => 'PERSONAL_NOTIFICATIONS_AUDIO_DEACTIVATED',
            ':value' => '0',
            ':description' => 'Deaktiviert das Abspielen von Tönen für die persönlichen Benachrichtigungen',
        ]);
    }

    protected function down()
    {
        $query = "DELETE FROM `config`
                  WHERE `field` IN (
                    'PERSONAL_NOTIFICATIONS_DEACTIVATED',
                    'PERSONAL_NOTIFICATIONS_AUDIO_DEACTIVATED'
                  )";
        DBManager::get()->execute($query);
    }
}