summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2014-12-25 20:57:02 +0100
committerPhilip Häusler <msquare@notrademark.de>2014-12-25 20:57:02 +0100
commit74b98b8c3e37c2ff578617d3c3b4ab2b02cb06b9 (patch)
tree15cf588803ee98b290e434bb9290441d59210d1b
parent3770ab82715e857a9b2ee2f74bcc73c5b917d8d4 (diff)
fix update script for shifttypes
-rw-r--r--db/update.sql5
1 files changed, 3 insertions, 2 deletions
diff --git a/db/update.sql b/db/update.sql
index 401be215..681d2a7c 100644
--- a/db/update.sql
+++ b/db/update.sql
@@ -12,11 +12,12 @@ INSERT INTO `engelsystem`.`Privileges` (`id`, `name`, `desc`) VALUES (NULL , 'sh
INSERT INTO `GroupPrivileges` SET `group_id`=-5, `privilege_id`=(SELECT `id` FROM `Privileges` WHERE `name`='shifttypes');
ALTER TABLE `Shifts` ADD `shifttype_id` INT NOT NULL AFTER `SID`, ADD INDEX ( `shifttype_id` );
+UPDATE `Shifts` SET `name`='' WHERE `name` IS NULL;
INSERT INTO `ShiftTypes` SELECT DISTINCT NULL , `name` , NULL , '' FROM `Shifts`;
UPDATE `Shifts` SET `shifttype_id`=(SELECT `id` FROM `ShiftTypes` WHERE `ShiftTypes`.`name`=`Shifts`.`name`);
-ALTER TABLE `Shifts` DROP `name`;
-ALTER TABLE `Shifts` ADD FOREIGN KEY ( `shifttype_id` ) REFERENCES `engelsystem`.`ShiftTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `Shifts` ADD `title` TEXT NULL AFTER `SID`;
+ALTER TABLE `Shifts` ADD FOREIGN KEY ( `shifttype_id` ) REFERENCES `engelsystem`.`ShiftTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
+ALTER TABLE `Shifts` DROP `name`;
/* cleanup */
ALTER TABLE `User` DROP `ICQ` ;