From 86a38a3372557bd72db309e7b24b4a4a95544397 Mon Sep 17 00:00:00 2001
From: msquare <msquare@notrademark.de>
Date: Fri, 29 Dec 2017 17:19:27 +0100
Subject: add user work log entries feature

---
 db/update.sql | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'db/update.sql')

diff --git a/db/update.sql b/db/update.sql
index 212cd97e..351cf8b4 100644
--- a/db/update.sql
+++ b/db/update.sql
@@ -49,3 +49,10 @@ ALTER TABLE `Room` ADD `description` TEXT NULL AFTER `map_url`;
 -- Dashboard
 ALTER TABLE `AngelTypes` ADD `show_on_dashboard` BOOLEAN NOT NULL AFTER `contact_email`;
 UPDATE `AngelTypes` SET `show_on_dashboard` = TRUE;
+
+-- Work Log
+CREATE TABLE `engelsystem`.`UserWorkLog` ( `id` INT NOT NULL AUTO_INCREMENT , `user_id` INT NOT NULL , `work_hours` DECIMAL NOT NULL , `comment` VARCHAR(200) NOT NULL , `created_user_id` INT NOT NULL , `created_timestamp` INT NOT NULL , PRIMARY KEY (`id`), INDEX (`user_id`), INDEX (`created_user_id`)) ENGINE = InnoDB;
+ALTER TABLE `UserWorkLog` ADD FOREIGN KEY (`created_user_id`) REFERENCES `User`(`UID`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `UserWorkLog` ADD FOREIGN KEY (`user_id`) REFERENCES `User`(`UID`) ON DELETE CASCADE ON UPDATE CASCADE;
+ALTER TABLE `UserWorkLog` ADD INDEX(`created_timestamp`);
+INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (NULL, 'admin_user_worklog', 'Manage user work log entries.');
+ALTER TABLE `UserWorkLog` CHANGE `work_hours` `work_hours` DECIMAL(10,2) NOT NULL;
-- 
cgit v1.2.3-54-g00ecf

