aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/5.1.9_tic11418_studygroup_terms_i18n.php
blob: 7537d5112e5b21824d6f1581919c4d8fb0e1f222 (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
<?php
/**
 * @author Jan-Hendrik Willms <tleilax+studip@gmail.com>
 * @see    https://develop.studip.de/trac/ticket/11418
 */
class Tic11418StudygroupTermsI18n extends Migration
{
    public function description()
    {
        return 'Changes config type to i18n for field STUDYGROUP_TERMS';
    }

    protected function up()
    {
        $query = "UPDATE `config`
                  SET `type` = 'i18n'
                  WHERE `field` = 'STUDYGROUP_TERMS'";
        DBManager::get()->exec($query);
    }

    protected function down()
    {
        $query = "DELETE FROM `i18n`
                  WHERE `object_id` = MD5('STUDYGROUP_TERMS')
                    AND `table` = 'config'
                    AND `field` = 'value'";
        DBManager::get()->exec($query);

        $query = "UPDATE `config`
                  SET `type` = 'string'
                  WHERE `field` = 'STUDYGROUP_TERMS'";
        DBManager::get()->exec($query);
    }
}