aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.182_step_raum_zeit_end_offset.php
blob: 71eb020f97d1e86b96be4785927b961a4ad3f59e (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
<?php
class StepRaumZeitEndOffset extends Migration
{
    public function description()
    {
        return _('Fügt eine neue Spalte hinzu, die Semesterwochhe für das Ende zu speicher!');
    }

    public function up()
    {
        DBManager::get()->exec('ALTER TABLE `seminar_cycle_dates` ADD COLUMN `end_offset` TINYINT(3) NULL AFTER `week_offset`');

        //CHANGE route entry in help_content from raumzeit.php to new dispatch.php/course/timesrooms
        $query = 'UPDATE `help_content` SET route = :new WHERE route = :old';
        $stm = DBManager::get()->prepare($query);
        $stm->execute([':new' => 'dispatch.php/course/timesrooms', ':old' => 'raumzeit.php']);
    }

    public function down()
    {
        DBManager::get()->exec('ALTER TABLE `seminar_cycle_dates` DROP COLUMN `end_offset`');

        //CHANGE route entry in help_content from dispatch.php/course/timesrooms back to raumzeit.php
        $query = 'UPDATE `help_content` SET route = :old WHERE route = :new';
        $stm = DBManager::get()->prepare($query);
        $stm->execute([':new' => 'dispatch.php/course/timesrooms', ':old' => 'raumzeit.php']);
    }
}