engelsystem/db/update.sql

90 lines
3.9 KiB
MySQL
Raw Normal View History

2015-08-15 14:54:25 +02:00
/* Introduce planned departure date */
ALTER TABLE `User` ADD `planned_departure_date` INT NULL, ADD INDEX ( `planned_departure_date` );
/* Allow longer angeltype names */
ALTER TABLE `AngelTypes` CHANGE `name` `name` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
2015-08-12 23:44:39 +02:00
/* Enable multiple vouchers */
ALTER TABLE `User` CHANGE `got_voucher` `got_voucher` INT NOT NULL;
2015-07-12 14:45:58 +02:00
/* introduce user arrival date */
ALTER TABLE `User` ADD `arrival_date` INT NULL ,
ADD `planned_arrival_date` INT NOT NULL ,
ADD INDEX ( `arrival_date` , `planned_arrival_date` ) ;
2014-12-26 22:03:35 +01:00
/* fix log */
ALTER TABLE `LogEntries` CHANGE `nick` `nick` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ;
2014-12-26 01:49:59 +01:00
/* 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,
`name` varchar(255) NOT NULL,
`angeltype_id` int(11) DEFAULT NULL,
`description` text NOT NULL,
PRIMARY KEY (`id`)
2014-12-16 09:25:36 +01:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
ALTER TABLE `ShiftTypes` ADD INDEX ( `angeltype_id` );
2014-12-26 01:49:59 +01:00
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');
2014-12-16 09:25:36 +01:00
INSERT INTO `GroupPrivileges` SET `group_id`=-5, `privilege_id`=(SELECT `id` FROM `Privileges` WHERE `name`='shifttypes');
2014-12-17 17:22:35 +01:00
ALTER TABLE `Shifts` ADD `shifttype_id` INT NOT NULL AFTER `SID`, ADD INDEX ( `shifttype_id` );
2014-12-25 20:57:02 +01:00
UPDATE `Shifts` SET `name`='' WHERE `name` IS NULL;
2014-12-17 17:22:35 +01:00
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`;
2014-12-26 01:49:59 +01:00
ALTER TABLE `Shifts` ADD FOREIGN KEY ( `shifttype_id` ) REFERENCES `ShiftTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
2014-12-25 20:57:02 +01:00
ALTER TABLE `Shifts` DROP `name`;
2014-12-17 17:22:35 +01:00
/* cleanup */
ALTER TABLE `User` DROP `ICQ` ;
/* opt-in field for user shiftinfo mails */
ALTER TABLE `User` ADD `email_shiftinfo` BOOLEAN NOT NULL DEFAULT FALSE COMMENT 'User wants to be informed by mail about changes in his shifts' AFTER `email` ;
2014-08-22 22:34:13 +02:00
/* fix questions */
ALTER TABLE `Questions` CHANGE `AID` `AID` INT( 11 ) NULL DEFAULT NULL ;
/* teamcoordinators */
ALTER TABLE `UserAngelTypes` ADD `coordinator` BOOLEAN NOT NULL;
ALTER TABLE `UserAngelTypes` ADD INDEX ( `coordinator` );
/* angeltype view */
INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (NULL , 'angeltypes', 'View angeltypes');
2013-12-28 03:02:51 +01:00
/* force active */
ALTER TABLE `User` ADD `force_active` BOOLEAN NOT NULL AFTER `Aktiv`, ADD INDEX ( `force_active` );
2013-12-27 18:45:27 +01:00
/* freeloader */
ALTER TABLE `ShiftEntry` ADD `freeloaded` BOOLEAN NOT NULL, ADD INDEX ( `freeloaded` );
ALTER TABLE `ShiftEntry` ADD `freeload_comment` TEXT NULL DEFAULT NULL;
2013-12-26 13:34:48 +01:00
/* password recovery */
ALTER TABLE `User` ADD `password_recovery_token` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `Passwort` ,
ADD INDEX ( `password_recovery_token` );
2011-10-11 19:47:49 +02:00
/* Update für #27, iCal-Export */
2011-10-11 23:43:44 +02:00
ALTER TABLE `User` ADD `ical_key` VARCHAR( 32 ) NOT NULL;
2011-10-11 23:45:14 +02:00
ALTER TABLE `User` ADD INDEX ( `ical_key` );
2011-10-11 19:47:49 +02:00
2011-10-11 23:48:29 +02:00
INSERT INTO `Privileges` (
2011-10-11 19:47:49 +02:00
`id` ,
`name` ,
`desc`
)
VALUES (
2011-10-11 23:48:29 +02:00
NULL , 'ical', 'iCal shift export'
);
/* DECT Nummern können für GSM auch 5-stellig sein. */
2011-12-21 22:20:06 +01:00
ALTER TABLE `User` CHANGE `DECT` `DECT` VARCHAR( 5 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
/* Neues Engeltypen-System */
ALTER TABLE `AngelTypes` DROP `Man`;
ALTER TABLE `AngelTypes` CHANGE `TID` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;
ALTER TABLE `AngelTypes` CHANGE `Name` `name` VARCHAR( 25 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
ALTER TABLE `AngelTypes` ADD `restricted` INT( 1 ) NOT NULL;
2014-03-09 13:12:46 +01:00
ALTER TABLE `AngelTypes` ADD `description` TEXT NOT NULL;