aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/5.5.28_biest3893_performance_calendar.php
blob: 82a86fecbe5cb8bdd132660e9683aeb11fb4685d (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
<?php

final class Biest3893PerformanceCalendar extends Migration
{
    public function description()
    {
        return 'add index to calendar tables';
    }

    public function up()
    {
        $db = DBManager::get();
        $db->exec("DELETE FROM `calendar_date_exceptions` WHERE `date` = '1970-01-01'");
        $db->exec("ALTER TABLE `calendar_date_exceptions` ADD INDEX(`calendar_date_id`)");
        $db->exec("ALTER TABLE `calendar_dates` ADD INDEX `repetition_type` (`repetition_type`, `repetition_end`)");
        $db->exec("ALTER TABLE `calendar_dates` ADD INDEX `begin` (`begin`)");
        try {
            $db->exec("ALTER TABLE `calendar_dates` DROP INDEX `uid`");
        } catch (PDOException $exception) {}
    }

    public function down()
    {
    }
}