summaryrefslogtreecommitdiff
path: root/plugins/Group_assign/Schema/Postgres.php
blob: 54b0a2bea2df052ed0b38265da259f475e96f473 (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

namespace Kanboard\Plugin\group_assign\Schema;

use PDO;

const VERSION = 2;

function version_2(PDO $pdo)
{
    $pdo->exec("ALTER TABLE tasks ADD COLUMN owner_ms INT DEFAULT '0'");
    
    $pdo->exec("
        CREATE TABLE multiselect (
            id SERIAL PRIMARY KEY,
            external_id VARCHAR(255) DEFAULT ''
        )
    ");
    
    $pdo->exec("
        CREATE TABLE multiselect_has_users (
            group_id INTEGER NOT NULL,
            user_id INTEGER NOT NULL,
            FOREIGN KEY(group_id) REFERENCES multiselect(id) ON DELETE CASCADE,
            FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,
            UNIQUE(group_id, user_id)
        )
    ");
}

function version_1(PDO $pdo)
{
    $pdo->exec("ALTER TABLE tasks ADD COLUMN owner_gp INT DEFAULT '0'");
}