Started to work on ttRegistrator class to encapsulate restration related tasks.
[timetracker.git] / mysql.sql
index 6c2d0f5..61b3909 100644 (file)
--- a/mysql.sql
+++ b/mysql.sql
@@ -83,14 +83,14 @@ CREATE TABLE `tt_users` (
   `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
-  `created_timestamp` timestamp default NULL,      # creation timestamp
-  `created_ip` varchar(45) default NULL,           # creation ip
+  `created` datetime default NULL,                 # creation timestamp
+  `created_ip` varchar(45) default NULL,           # creator ip
   `created_by` int(11) default NULL,               # creator user_id (null for self)
-  `modified_timestamp` timestamp default NULL,     # modification timestamp
-  `modified_ip` varchar(45) default NULL,          # modification ip
+  `modified` datetime default NULL,                # modification timestamp
+  `modified_ip` varchar(45) default NULL,          # modifier ip
   `modified_by` int(11) default NULL,              # modifier user_id
-  `last_access_timestamp` timestamp default NULL,  # last access timestamp
-  `last_access_ip` varchar(45) default NULL,       # last access ip
+  `accessed` datetime default NULL,                # last access timestamp
+  `accessed_ip` varchar(45) default NULL,          # last access ip
   `status` tinyint(4) default 1,                   # user status
   PRIMARY KEY (`id`)
 );
@@ -171,7 +171,6 @@ create index task_idx on tt_project_task_binds(task_id);
 #
 CREATE TABLE `tt_log` (
   `id` bigint NOT NULL auto_increment,             # time record id
-  `timestamp` timestamp default CURRENT_TIMESTAMP, # modification timestamp
   `user_id` int(11) NOT NULL,                      # user id
   `date` date NOT NULL,                            # date the record is for
   `start` time default NULL,                       # record start time (for example, 09:00)
@@ -183,6 +182,12 @@ CREATE TABLE `tt_log` (
   `comment` text,                                  # user provided comment for time record
   `billable` tinyint(4) default 0,                 # whether the record is billable or not
   `paid` tinyint(4) default 0,                     # whether the record is paid
+  `created` datetime default NULL,                 # creation timestamp
+  `created_ip` varchar(45) default NULL,           # creator ip
+  `created_by` int(11) default NULL,               # creator user_id
+  `modified` datetime default NULL,                # modification timestamp
+  `modified_ip` varchar(45) default NULL,          # modifier ip
+  `modified_by` int(11) default NULL,              # modifier user_id
   `status` tinyint(4) default 1,                   # time record status
   PRIMARY KEY (`id`)
 );
@@ -245,6 +250,7 @@ CREATE TABLE `tt_fav_reports` (
   `show_client` tinyint(4) NOT NULL default 0,           # whether to show client column
   `show_invoice` tinyint(4) NOT NULL default 0,          # whether to show invoice column
   `show_paid` tinyint(4) NOT NULL default 0,             # whether to show paid column
+  `show_ip` tinyint(4) NOT NULL default 0,               # whether to show ip column
   `show_project` tinyint(4) NOT NULL default 0,          # whether to show project column
   `show_start` tinyint(4) NOT NULL default 0,            # whether to show start field
   `show_duration` tinyint(4) NOT NULL default 0,         # whether to show duration field
@@ -371,16 +377,22 @@ CREATE TABLE `tt_custom_field_log` (
 # This table lists expense items.
 #
 CREATE TABLE `tt_expense_items` (
-  `id` bigint NOT NULL auto_increment, # expense item id
-  `date` date NOT NULL,                # date the record is for
-  `user_id` int(11) NOT NULL,          # user id the expense item is reported by
-  `client_id` int(11) default NULL,    # client id
-  `project_id` int(11) default NULL,   # project id
-  `name` text NOT NULL,                # expense item name (what is an expense for)   
-  `cost` decimal(10,2) default '0.00', # item cost (including taxes, etc.)
-  `invoice_id` int(11) default NULL,   # invoice id
-  `paid` tinyint(4) default 0,         # whether the item is paid
-  `status` tinyint(4) default 1,       # item status
+  `id` bigint NOT NULL auto_increment,    # expense item id
+  `date` date NOT NULL,                   # date the record is for
+  `user_id` int(11) NOT NULL,             # user id the expense item is reported by
+  `client_id` int(11) default NULL,       # client id
+  `project_id` int(11) default NULL,      # project id
+  `name` text NOT NULL,                   # expense item name (what is an expense for)
+  `cost` decimal(10,2) default '0.00',    # item cost (including taxes, etc.)
+  `invoice_id` int(11) default NULL,      # invoice id
+  `paid` tinyint(4) default 0,            # whether the item is paid
+  `created` datetime default NULL,        # creation timestamp
+  `created_ip` varchar(45) default NULL,  # creator ip
+  `created_by` int(11) default NULL,      # creator user_id
+  `modified` datetime default NULL,       # modification timestamp
+  `modified_ip` varchar(45) default NULL, # modifier ip
+  `modified_by` int(11) default NULL,     # modifier user_id
+  `status` tinyint(4) default 1,          # item status
   PRIMARY KEY  (`id`)
 );
 
@@ -429,9 +441,9 @@ ALTER TABLE `tt_monthly_quotas`
 CREATE TABLE `tt_site_config` (
   `param_name` varchar(32) NOT NULL, # parameter name
   `param_value` text default NULL,   # parameter value
-  `created` datetime default NULL,   # creation time
-  `updated` datetime default NULL,   # modification time
+  `created` datetime default NULL,   # creation timestamp
+  `modified` datetime default NULL,  # modification timestamp
   PRIMARY KEY  (`param_name`)
 );
 
-INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.17.52', now()); # TODO: change when structure changes.
+INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.17.64', now()); # TODO: change when structure changes.