aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/5.4.14_restore_studip_object_id.php
blob: 00bb0c0b22473ab18472089001e3084bde2fecbd (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
<?

final class RestoreStudipObjectId extends Migration
{

    use DatabaseMigrationTrait;

    public function description()
    {
        return 'Restores the studip_object_id column for sem_tree';
    }

    protected function up()
    {
        if (!$this->columnExists('sem_tree', 'studip_object_id')) {
            // Add database column for sem_tree institute assignments.
            DBManager::get()->exec("ALTER TABLE `sem_tree` ADD
                `studip_object_id` CHAR(32) CHARACTER SET latin1 COLLATE latin1_bin NULL DEFAULT NULL AFTER `name`");
            // Add index for studip_object_id.
            DBManager::get()->exec("ALTER TABLE `sem_tree` ADD INDEX `studip_object_id` (`studip_object_id`)");
        }
    }

}