From dded773749e869893a00865cf2183a7f0c684038 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Wed, 7 Sep 2016 22:40:38 -0400 Subject: Add new models ColumnMoveRestrictionModel and ProjectRoleModel --- app/Schema/Mysql.php | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'app/Schema/Mysql.php') diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index 99fed66f..11c7f232 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -6,7 +6,40 @@ use PDO; use Kanboard\Core\Security\Token; use Kanboard\Core\Security\Role; -const VERSION = 112; +const VERSION = 113; + +function version_113(PDO $pdo) +{ + $pdo->exec(" + CREATE TABLE project_has_roles ( + role_id INT NOT NULL AUTO_INCREMENT, + role VARCHAR(255) NOT NULL, + project_id INT NOT NULL, + UNIQUE(project_id, role), + FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE, + PRIMARY KEY(role_id) + ) ENGINE=InnoDB CHARSET=utf8 + "); + + $pdo->exec(" + CREATE TABLE column_has_move_restrictions ( + restriction_id INT NOT NULL AUTO_INCREMENT, + project_id INT NOT NULL, + role_id INT NOT NULL, + src_column_id INT NOT NULL, + dst_column_id INT NOT NULL, + UNIQUE(role_id, src_column_id, dst_column_id), + FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE, + FOREIGN KEY(role_id) REFERENCES project_has_roles(role_id) ON DELETE CASCADE, + FOREIGN KEY(src_column_id) REFERENCES columns(id) ON DELETE CASCADE, + FOREIGN KEY(dst_column_id) REFERENCES columns(id) ON DELETE CASCADE, + PRIMARY KEY(restriction_id) + ) ENGINE=InnoDB CHARSET=utf8 + "); + + $pdo->exec("ALTER TABLE `project_has_users` MODIFY `role` VARCHAR(255) NOT NULL"); + $pdo->exec("ALTER TABLE `project_has_groups` MODIFY `role` VARCHAR(255) NOT NULL"); +} function version_112(PDO $pdo) { -- cgit v1.2.3