From 0d139d09bd3304dd9666ea4a74d367ad16c85604 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Mon, 19 Nov 2018 21:12:06 +0000 Subject: [PATCH] Adding group_id and org_id to last 3 remaining tables. --- WEB-INF/templates/footer.tpl | 2 +- dbinstall.php | 6 ++++++ mysql.sql | 7 ++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index c6c6ed7d..9ace916c 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.22.4467 | Copyright © Anuko | +  Anuko Time Tracker 1.18.23.4468 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/dbinstall.php b/dbinstall.php index c65175d5..90067399 100644 --- a/dbinstall.php +++ b/dbinstall.php @@ -1026,6 +1026,12 @@ if ($_POST) { setChange("ALTER TABLE `tt_config` ADD `org_id` int(11) default NULL AFTER `group_id`"); setChange("UPDATE `tt_site_config` SET param_value = '1.18.22', modified = now() where param_name = 'version_db' and param_value = '1.18.21'"); setChange("update `tt_config` c inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.22') inner join `tt_users` u on u.id = c.user_id set c.group_id = u.group_id, c.org_id = u.org_id where c.org_id is null"); + setChange("ALTER TABLE `tt_custom_fields` ADD `org_id` int(11) default NULL AFTER `group_id`"); + setChange("ALTER TABLE `tt_custom_field_options` ADD `group_id` int(11) default NULL AFTER `id`"); + setChange("ALTER TABLE `tt_custom_field_options` ADD `org_id` int(11) default NULL AFTER `group_id`"); + setChange("ALTER TABLE `tt_custom_field_log` ADD `group_id` int(11) default NULL AFTER `id`"); + setChange("ALTER TABLE `tt_custom_field_log` ADD `org_id` int(11) default NULL AFTER `group_id`"); + setChange("UPDATE `tt_site_config` SET param_value = '1.18.23', modified = now() where param_name = 'version_db' and param_value = '1.18.22'"); } if ($_POST["cleanup"]) { diff --git a/mysql.sql b/mysql.sql index e0c4145d..0bbf15d4 100644 --- a/mysql.sql +++ b/mysql.sql @@ -369,6 +369,7 @@ create unique index param_idx on tt_config(user_id, param_name); CREATE TABLE `tt_custom_fields` ( `id` int(11) NOT NULL auto_increment, # custom field id `group_id` int(11) NOT NULL, # group id + `org_id` int(11) default NULL, # organization id `type` tinyint(4) NOT NULL default 0, # custom field type (text or dropdown) `label` varchar(32) NOT NULL default '', # custom field label `required` tinyint(4) default 0, # whether this custom field is mandatory for time records @@ -382,6 +383,8 @@ CREATE TABLE `tt_custom_fields` ( # CREATE TABLE `tt_custom_field_options` ( `id` int(11) NOT NULL auto_increment, # option id + `group_id` int(11) default NULL, # group id + `org_id` int(11) default NULL, # organization id `field_id` int(11) NOT NULL, # custom field id `value` varchar(32) NOT NULL default '', # option value PRIMARY KEY (`id`) @@ -394,6 +397,8 @@ CREATE TABLE `tt_custom_field_options` ( # CREATE TABLE `tt_custom_field_log` ( `id` bigint NOT NULL auto_increment, # custom field log id + `group_id` int(11) default NULL, # group id + `org_id` int(11) default NULL, # organization id `log_id` bigint NOT NULL, # id of a record in tt_log this record corresponds to `field_id` int(11) NOT NULL, # custom field id `option_id` int(11) default NULL, # Option id. Used for dropdown custom fields. @@ -481,4 +486,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.22', now()); # TODO: change when structure changes. +INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.18.23', now()); # TODO: change when structure changes. -- 2.20.1