summaryrefslogtreecommitdiff
path: root/app/Schema/Postgres.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-10-17 15:27:43 -0400
committerFrederic Guillot <fred@kanboard.net>2015-10-17 15:27:43 -0400
commit9283fb88d80cb355ff98364a9a57b657fc511d98 (patch)
tree52c99cd8adf28e3eb2c30c3d625817b48a8cd4ec /app/Schema/Postgres.php
parent9153c6ff0ddb3170928d33599d9178e67ca466b6 (diff)
Add metadata for users, tasks and projects
Diffstat (limited to 'app/Schema/Postgres.php')
-rw-r--r--app/Schema/Postgres.php37
1 files changed, 35 insertions, 2 deletions
diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php
index ac8b15ee..1a399cfc 100644
--- a/app/Schema/Postgres.php
+++ b/app/Schema/Postgres.php
@@ -6,7 +6,40 @@ use PDO;
use Kanboard\Core\Security;
use Kanboard\Model\Link;
-const VERSION = 72;
+const VERSION = 73;
+
+function version_73($pdo)
+{
+ $pdo->exec("
+ CREATE TABLE user_has_metadata (
+ user_id INTEGER NOT NULL,
+ name VARCHAR(50) NOT NULL,
+ value VARCHAR(255) DEFAULT '',
+ FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,
+ UNIQUE(user_id, name)
+ )
+ ");
+
+ $pdo->exec("
+ CREATE TABLE project_has_metadata (
+ project_id INTEGER NOT NULL,
+ name VARCHAR(50) NOT NULL,
+ value VARCHAR(255) DEFAULT '',
+ FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,
+ UNIQUE(project_id, name)
+ )
+ ");
+
+ $pdo->exec("
+ CREATE TABLE task_has_metadata (
+ task_id INTEGER NOT NULL,
+ name VARCHAR(50) NOT NULL,
+ value VARCHAR(255) DEFAULT '',
+ FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE,
+ UNIQUE(task_id, name)
+ )
+ ");
+}
function version_72($pdo)
{
@@ -14,7 +47,7 @@ function version_72($pdo)
CREATE TABLE project_has_notification_types (
id SERIAL PRIMARY KEY,
project_id INTEGER NOT NULL,
- notification_type VARCHAR(50),
+ notification_type VARCHAR(50) NOT NULL,
FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,
UNIQUE(project_id, notification_type)
)