From 06b80cf38fc0268250fcca3b7270801b4991505f Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sun, 18 Nov 2018 18:14:03 +0000 Subject: [PATCH] Introduced an index in tt_project_task_binds to eliminate duplicates. --- WEB-INF/templates/footer.tpl | 2 +- dbinstall.php | 1 + mysql.sql | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 7eb70484..f66ff9ba 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.17.4449 | Copyright © Anuko | +  Anuko Time Tracker 1.18.17.4450 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/dbinstall.php b/dbinstall.php index ef895bdd..e3561edd 100644 --- a/dbinstall.php +++ b/dbinstall.php @@ -1008,6 +1008,7 @@ if ($_POST) { setChange("UPDATE `tt_expense_items` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.17') set org_id = group_id where org_id is null"); setChange("update `tt_user_project_binds` upb inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.17') inner join `tt_users` u on u.id = upb.user_id set upb.group_id = u.group_id, upb.org_id = u.org_id where upb.org_id is null"); setChange("update `tt_project_task_binds` ptb inner join tt_site_config sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.17') inner join `tt_projects` p on p.id = ptb.project_id set ptb.group_id = p.group_id, ptb.org_id = p.org_id where ptb.org_id is null"); + setChange("create unique index project_task_idx on tt_project_task_binds(project_id, task_id)"); } if ($_POST["cleanup"]) { diff --git a/mysql.sql b/mysql.sql index 5ee9ad4a..23dbb14a 100644 --- a/mysql.sql +++ b/mysql.sql @@ -177,6 +177,7 @@ CREATE TABLE `tt_project_task_binds` ( # Indexes for tt_project_task_binds. create index project_idx on tt_project_task_binds(project_id); create index task_idx on tt_project_task_binds(task_id); +create unique index project_tax_idx on tt_project_task_binds(project_id, task_id); # @@ -472,4 +473,4 @@ CREATE TABLE `tt_site_config` ( PRIMARY KEY (`param_name`) ); -INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.18.17', now()); # TODO: change when structure changes. +INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.18.18', now()); # TODO: change when structure changes. -- 2.20.1