From 8ed077bcece00bd056a878c86a9cf2c672d4306e Mon Sep 17 00:00:00 2001 From: Philip Häusler Date: Fri, 26 Dec 2014 01:49:59 +0100 Subject: user voucher feature --- db/update.sql | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'db/update.sql') diff --git a/db/update.sql b/db/update.sql index 681d2a7c..db7d75ed 100644 --- a/db/update.sql +++ b/db/update.sql @@ -1,3 +1,6 @@ +/* introduce got-voucher flag */ +ALTER TABLE `User` ADD `got_voucher` BOOLEAN NOT NULL; + /* introduce shift types */ CREATE TABLE IF NOT EXISTS `ShiftTypes` ( `id` int(11) NOT NULL AUTO_INCREMENT, @@ -7,8 +10,8 @@ CREATE TABLE IF NOT EXISTS `ShiftTypes` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; ALTER TABLE `ShiftTypes` ADD INDEX ( `angeltype_id` ); -ALTER TABLE `ShiftTypes` ADD FOREIGN KEY ( `angeltype_id` ) REFERENCES `engelsystem`.`AngelTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; -INSERT INTO `engelsystem`.`Privileges` (`id`, `name`, `desc`) VALUES (NULL , 'shifttypes', 'Administrate shift types'); +ALTER TABLE `ShiftTypes` ADD FOREIGN KEY ( `angeltype_id` ) REFERENCES `AngelTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; +INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (NULL , 'shifttypes', 'Administrate shift types'); 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` ); @@ -16,7 +19,7 @@ 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` 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` ADD FOREIGN KEY ( `shifttype_id` ) REFERENCES `ShiftTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `Shifts` DROP `name`; /* cleanup */ -- cgit v1.2.3-70-g09d2