diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-06-23 20:26:19 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-06-23 20:26:19 -0400 |
commit | d560f84b374fa1b3345dc582eddd6bb7b9138674 (patch) | |
tree | a7d9a429ee3094d530c8ca5dea2bda6709c08b82 /app/Schema/Postgres.php | |
parent | 95751f391f336faf82ee2402a559247aef668e72 (diff) |
Added models for tags
Diffstat (limited to 'app/Schema/Postgres.php')
-rw-r--r-- | app/Schema/Postgres.php | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index 3ef49498..229cbd25 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -6,7 +6,29 @@ use PDO; use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; -const VERSION = 89; +const VERSION = 90; + +function version_90(PDO $pdo) +{ + $pdo->exec(" + CREATE TABLE tags ( + id SERIAL PRIMARY KEY, + name VARCHAR(255) NOT NULL, + project_id INTEGER NOT NULL, + UNIQUE(project_id, name) + ) + "); + + $pdo->exec(" + CREATE TABLE task_has_tags ( + task_id INTEGER NOT NULL, + tag_id INTEGER NOT NULL, + FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE, + FOREIGN KEY(tag_id) REFERENCES tags(id) ON DELETE CASCADE, + UNIQUE(tag_id, task_id) + ) + "); +} function version_89(PDO $pdo) { |