From ad495718373d61982d81c3eebd3bc9d2921186b1 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Mon, 19 Nov 2018 17:01:51 +0000 Subject: [PATCH] Added an index to tt_client_project_binds to guarantee uniqueness. --- WEB-INF/templates/footer.tpl | 2 +- dbinstall.php | 1 + mysql.sql | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 8d292fc5..cab56b71 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.21.4461 | Copyright © Anuko | +  Anuko Time Tracker 1.18.21.4462 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/dbinstall.php b/dbinstall.php index bfbb5c2c..60244914 100644 --- a/dbinstall.php +++ b/dbinstall.php @@ -1021,6 +1021,7 @@ if ($_POST) { setChange("ALTER TABLE `tt_client_project_binds` ADD `org_id` int(11) default NULL AFTER `group_id`"); setChange("update `tt_client_project_binds` cpb inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.20') inner join `tt_clients` c on c.id = cpb.client_id set cpb.group_id = c.group_id, cpb.org_id = c.org_id where cpb.org_id is null"); setChange("UPDATE `tt_site_config` SET param_value = '1.18.21', modified = now() where param_name = 'version_db' and param_value = '1.18.20'"); + setChange("create unique index client_project_idx on tt_client_project_binds(client_id, project_id)"); } if ($_POST["cleanup"]) { diff --git a/mysql.sql b/mysql.sql index 705e664f..bc970f73 100644 --- a/mysql.sql +++ b/mysql.sql @@ -342,6 +342,7 @@ CREATE TABLE `tt_client_project_binds` ( # Indexes for tt_client_project_binds. create index client_idx on tt_client_project_binds(client_id); create index project_idx on tt_client_project_binds(project_id); +create unique index client_project_idx on tt_client_project_binds(client_id, project_id); # -- 2.20.1