All database changes in an update script. Devel database is already updated.
This commit is contained in:
parent
23a903997a
commit
3ae282102c
51
misc/update_1.1_to_1.2.sql
Normal file
51
misc/update_1.1_to_1.2.sql
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
-- add notification handling columns to shipcall
|
||||||
|
-- evaluation_time: Time when the "traffic light" was last changed
|
||||||
|
-- evaluation_notifications_sent: Flag to indicate if notifications were sent for the current evaluation
|
||||||
|
|
||||||
|
ALTER TABLE `bremen_calling_devel`.`shipcall`
|
||||||
|
ADD COLUMN `evaluation_time` DATETIME NULL DEFAULT NULL AFTER `evaluation_message`,
|
||||||
|
ADD COLUMN `evaluation_notifications_sent` BIT NULL AFTER `evaluation_time`;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- prepare notification table for historic notification data
|
||||||
|
-- removed reference to participant and times and dropped unnecessary columns
|
||||||
|
-- added reference to shipcall
|
||||||
|
|
||||||
|
ALTER TABLE `bremen_calling_devel`.`notification`
|
||||||
|
DROP FOREIGN KEY `FK_NOT_TIMES`,
|
||||||
|
DROP FOREIGN KEY `FK_NOT_PART`;
|
||||||
|
ALTER TABLE `bremen_calling_devel`.`notification`
|
||||||
|
DROP COLUMN `deleted`,
|
||||||
|
DROP COLUMN `acknowledged`,
|
||||||
|
DROP COLUMN `participant_id`,
|
||||||
|
DROP COLUMN `times_id`,
|
||||||
|
ADD COLUMN `shipcall_id` INT UNSIGNED NULL AFTER `id`,
|
||||||
|
ADD INDEX `FK_NOTIFICATION_SHIPCALL_idx` (`shipcall_id` ASC) VISIBLE,
|
||||||
|
DROP INDEX `FK_NOT_PART` ,
|
||||||
|
DROP INDEX `FK_NOT_TIMES` ;
|
||||||
|
;
|
||||||
|
ALTER TABLE `bremen_calling_devel`.`notification`
|
||||||
|
ADD CONSTRAINT `FK_NOTIFICATION_SHIPCALL`
|
||||||
|
FOREIGN KEY (`shipcall_id`)
|
||||||
|
REFERENCES `bremen_calling_devel`.`shipcall` (`id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION;
|
||||||
|
|
||||||
|
|
||||||
|
-- added notification flags
|
||||||
|
-- participant reference is now mandatory
|
||||||
|
|
||||||
|
ALTER TABLE `bremen_calling_devel`.`user`
|
||||||
|
DROP FOREIGN KEY `FK_USER_PART`;
|
||||||
|
ALTER TABLE `bremen_calling_devel`.`user`
|
||||||
|
ADD COLUMN `notify_email` BIT NULL DEFAULT NULL AFTER `api_key`,
|
||||||
|
ADD COLUMN `notify_whatsapp` BIT NULL DEFAULT NULL AFTER `notify_email`,
|
||||||
|
ADD COLUMN `notify_signal` BIT NULL DEFAULT NULL AFTER `notify_whatsapp`,
|
||||||
|
ADD COLUMN `notifiy_popup` BIT NULL DEFAULT NULL AFTER `notify_signal`,
|
||||||
|
CHANGE COLUMN `participant_id` `participant_id` INT UNSIGNED NOT NULL ;
|
||||||
|
ALTER TABLE `bremen_calling_devel`.`user`
|
||||||
|
ADD CONSTRAINT `FK_USER_PART`
|
||||||
|
FOREIGN KEY (`participant_id`)
|
||||||
|
REFERENCES `bremen_calling_devel`.`participant` (`id`);
|
||||||
|
|
||||||
Reference in New Issue
Block a user