aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.324_drop_citation_style.php
blob: e708e5aff513f3af989529a464dc9024ab9c8244 (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
39
40
41
42
43
<?php

class DropCitationStyle extends Migration
{
    public function description()
    {
        return 'Drop unused LIBRARY_CITATION_STYLE settings';
    }

    public function up()
    {
        // remove config entries
        $query = "DELETE `config`, `config_values`
                  FROM `config`
                  LEFT JOIN `config_values` USING (`field`)
                  WHERE `field` IN ('COURSE_LIBRARY_CITATION_STYLE', 'USER_LIBRARY_CITATION_STYLE')";
        DBManager::get()->exec($query);
    }

    public function down()
    {
        // create config entries
        $query = "INSERT INTO `config` (`field`, `value`, `type`, `range`, `section`, `mkdate`, `chdate`, `description`)
                  VALUES (:name, :value, :type, :range, :section, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :description)";
        $statement = DBManager::get()->prepare($query);
        $statement->execute([
            ':name'        => 'COURSE_LIBRARY_CITATION_STYLE',
            ':description' => 'Der standardmäßig genutzte Zitationsstil innerhalb der Veranstaltung.',
            ':section'     => 'Library',
            ':range'       => 'course',
            ':type'        => 'string',
            ':value'       => ''
        ]);
        $statement->execute([
            ':name'        => 'USER_LIBRARY_CITATION_STYLE',
            ':description' => 'Der präferierte Zitationsstil einer Person.',
            ':section'     => 'Library',
            ':range'       => 'user',
            ':type'        => 'string',
            ':value'       => ''
        ]);
    }
}