summaryrefslogtreecommitdiff
path: root/app/Schema/Postgres.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-11-25 22:06:39 -0500
committerFrederic Guillot <fred@kanboard.net>2015-11-25 22:06:39 -0500
commite582d4047b061f0c17e6366fed2bf1cabd624c10 (patch)
tree4f400b1df198103fb257d468b1aab8c625f32d29 /app/Schema/Postgres.php
parenta8da794b60029c23424ee330e020d18f5f9ac947 (diff)
Add groups (teams)
Diffstat (limited to 'app/Schema/Postgres.php')
-rw-r--r--app/Schema/Postgres.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php
index 5cd1a7d0..a3887cfb 100644
--- a/app/Schema/Postgres.php
+++ b/app/Schema/Postgres.php
@@ -5,7 +5,28 @@ namespace Schema;
use PDO;
use Kanboard\Core\Security\Token;
-const VERSION = 74;
+const VERSION = 75;
+
+function version_75(PDO $pdo)
+{
+ $pdo->exec("
+ CREATE TABLE groups (
+ id SERIAL PRIMARY KEY,
+ external_id VARCHAR(255) DEFAULT '',
+ name VARCHAR(100) NOT NULL UNIQUE
+ )
+ ");
+
+ $pdo->exec("
+ CREATE TABLE group_has_users (
+ group_id INTEGER NOT NULL,
+ user_id INTEGER NOT NULL,
+ FOREIGN KEY(group_id) REFERENCES groups(id) ON DELETE CASCADE,
+ FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,
+ UNIQUE(group_id, user_id)
+ )
+ ");
+}
function version_74(PDO $pdo)
{