summaryrefslogtreecommitdiff
path: root/schemas/mysql.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-05-21 22:33:57 -0400
committerFrédéric Guillot <fred@kanboard.net>2014-05-21 22:33:57 -0400
commita750b8ab2a0cb715da6fd9025a7ec8375db68a4d (patch)
tree5d5cdac1830336baf93b057e93cd2c1c56f405de /schemas/mysql.php
parent57e40671af56ae49eda467d9d5949bf9707020ee (diff)
Add categories for projects and tasks
Diffstat (limited to 'schemas/mysql.php')
-rw-r--r--schemas/mysql.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/schemas/mysql.php b/schemas/mysql.php
index 46f56e7b..eb869465 100644
--- a/schemas/mysql.php
+++ b/schemas/mysql.php
@@ -2,6 +2,22 @@
namespace Schema;
+function version_16($pdo)
+{
+ $pdo->exec("
+ CREATE TABLE project_has_categories (
+ id INT NOT NULL AUTO_INCREMENT,
+ name VARCHAR(255),
+ project_id INT,
+ PRIMARY KEY (id),
+ UNIQUE KEY `idx_project_category` (project_id, name),
+ FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE
+ ) ENGINE=InnoDB CHARSET=utf8"
+ );
+
+ $pdo->exec("ALTER TABLE tasks ADD COLUMN category_id INT DEFAULT 0");
+}
+
function version_15($pdo)
{
$pdo->exec("ALTER TABLE projects ADD COLUMN last_modified INT DEFAULT 0");