From 6cb9c41aae566dcc564fa8ad3a6c6ee4facdf373 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Tue, 27 Feb 2018 23:34:46 +0000 Subject: [PATCH] Introduced role_id for users, also tt_site_config table vor version. --- WEB-INF/templates/footer.tpl | 2 +- dbinstall.php | 13 ++++++++----- mysql.sql | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 4a799d98..a5f4bd52 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - - + +
 Anuko Time Tracker 1.17.33.4032 | Copyright © Anuko | +  Anuko Time Tracker 1.17.34.4033 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/dbinstall.php b/dbinstall.php index 6dc831ae..d84cf4f3 100755 --- a/dbinstall.php +++ b/dbinstall.php @@ -709,7 +709,7 @@ if ($_POST) { setChange("ALTER TABLE `tt_log` ADD `paid` tinyint(4) NULL default '0' AFTER `billable`"); } - if ($_POST["convert11400to11730"]) { + if ($_POST["convert11400to11734"]) { setChange("ALTER TABLE `tt_teams` DROP `address`"); setChange("ALTER TABLE `tt_fav_reports` ADD `report_spec` text default NULL AFTER `user_id`"); setChange("ALTER TABLE `tt_fav_reports` ADD `paid_status` tinyint(4) default NULL AFTER `invoice`"); @@ -729,9 +729,12 @@ if ($_POST) { setChange("ALTER TABLE `tt_teams` MODIFY `timestamp` timestamp default CURRENT_TIMESTAMP"); setChange("ALTER TABLE `tt_log` MODIFY `timestamp` timestamp default CURRENT_TIMESTAMP"); setChange("ALTER TABLE `tt_tmp_refs` MODIFY `timestamp` timestamp default CURRENT_TIMESTAMP"); - setChange("CREATE TABLE `tt_roles` (`id` int(11) NOT NULL auto_increment, `team_id` int(11) NOT NULL, `name` varchar(80) default NULL, `rank` int(11) default 0, `rights` text default NULL, `status` tinyint(4) default 1, PRIMARY KEY (`id`))"); + setChange("CREATE TABLE `tt_roles` (`id` int(11) NOT NULL auto_increment, `team_id` int(11) NOT NULL, `name` varchar(80) default NULL, `rank` int(11) default 0, `rights` text default NULL, `status` tinyint(4) default 1, PRIMARY KEY (`id`))"); setChange("create unique index role_idx on tt_roles(team_id, rank, status)"); setChange("ALTER TABLE `tt_roles` ADD `description` varchar(255) default NULL AFTER `name`"); + setChange("ALTER TABLE `tt_users` ADD `role_id` int(11) default NULL AFTER `role`"); + setChange("CREATE TABLE `tt_site_config` (`param_name` varchar(32) NOT NULL, `param_value` text default NULL, `created` datetime default CURRENT_TIMESTAMP, `updated` datetime ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`param_name`))"); + setChange("INSERT INTO `tt_site_config` (`param_name`, `param_value`) VALUES ('version_db', '1.17.34')"); } if ($_POST["cleanup"]) { @@ -777,7 +780,7 @@ if ($_POST) {

DB Install

-
Create database structure (v1.17.30) + Create database structure (v1.17.34)
(applies only to new installations, do not execute when updating)
@@ -813,8 +816,8 @@ if ($_POST) {

Update database structure (v1.14 to v1.17.30)
Update database structure (v1.14 to v1.17.34)
diff --git a/mysql.sql b/mysql.sql index a69387b3..c37a32c4 100644 --- a/mysql.sql +++ b/mysql.sql @@ -49,6 +49,7 @@ CREATE TABLE `tt_users` ( `name` varchar(100) default NULL, # user name `team_id` int(11) NOT NULL, # team id `role` int(11) default 4, # user role ("manager", "co-manager", "client", or "user") + `role_id` int(11) default NULL, # future replacement of role `client_id` int(11) default NULL, # client id for "client" user role `rate` float(6,2) NOT NULL default '0.00', # default hourly rate `email` varchar(100) default NULL, # user email @@ -407,3 +408,19 @@ CREATE TABLE `tt_roles` ( # Create an index that guarantees unique active and inactive role ranks in each group. create unique index role_idx on tt_roles(team_id, rank, status); + + +# +# Structure for table tt_site_config. This table stores configuration data +# for Time Tracker site as a whole. +# For example, database version, code version, site language, etc. +# +CREATE TABLE `tt_site_config` ( + `param_name` varchar(32) NOT NULL, # parameter name + `param_value` text default NULL, # parameter value + `created` datetime default CURRENT_TIMESTAMP, # creation time + `updated` datetime ON UPDATE CURRENT_TIMESTAMP, # modification time + PRIMARY KEY (`param_name`) +); + +INSERT INTO `tt_site_config` (`param_name`, `param_value`) VALUES ('version_db', '1.17.34'); # TODO: change when structure changes. -- 2.20.1