aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/6.0.52_vips_statusgruppe_user.php
blob: b0c716a6de7c6656591ef11b25ce5b5b5bb11152 (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
<?php

class VipsStatusgruppeUser extends Migration
{
    public function description()
    {
        return 'add missing entries in statusgruppe_user for vips migration';
    }

    public function up()
    {
        $db = DBManager::get();

        // the inital migration set these to 0
        $sql = "UPDATE etask_assignments SET end = NULL WHERE type = 'selftest' AND end = 0";
        $db->exec($sql);

        // the inital migration set these to 0
        $sql = 'UPDATE etask_group_members SET end = NULL WHERE end = 0';
        $db->exec($sql);

        // the inital migration did not add entries to statusgruppe_user
        $sql = 'INSERT IGNORE INTO statusgruppe_user (statusgruppe_id, user_id, mkdate)
                SELECT group_id, user_id, start FROM etask_group_members WHERE end IS NULL';
        $db->exec($sql);
    }
}