task/3382: Fix table notification_delivery_configuration and it's entity class.

This commit is contained in:
Tom Zhao 2024-06-19 15:54:38 +02:00
parent 76015ef660
commit 0f28cb10bc
2 changed files with 14 additions and 3 deletions
core/src/main
java/se/su/dsv/scipro/notifications/settings/entities
resources/db/migration

@ -8,7 +8,7 @@ import jakarta.persistence.*;
@Entity
@Table(name = "notification_delivery_configuration",
uniqueConstraints = {
@UniqueConstraint(name = "one_setting_per_user", columnNames = {"type", "event", "method", "user_id"})
@UniqueConstraint(name = "uk_one_setting_per_user", columnNames = {"type", "event", "method", "user_id"})
})
public class DeliveryConfiguration extends Configuration {

@ -586,6 +586,17 @@ alter table `reviewer_target`
on delete cascade
on update cascade;
-- table: notification_delivery_configuration
NIQUE KEY `UK_ReviewerTarget_ReviewerId_Year` (`reviewer_id`,`year`),
CONSTRAINT `FK_ReviewerTarget_ReviewerId` FOREIGN KEY (`reviewer_id`) REFERENCES `user` (`id`)
alter table `notification_delivery_configuration` drop foreign key `FK7B2EE5BF895349BF`;
alter table `notification_delivery_configuration` drop key `FK7B2EE5BF895349BF`;
alter table `notification_delivery_configuration` drop key `one_setting_per_user`;
alter table `notification_delivery_configuration` add constraint uk_one_setting_per_user unique(type, event, method, user_id);
alter table `notification_delivery_configuration`
add constraint fk_notification_delivery_configuration_user_id
foreign key (user_id)
references user(id)
on delete cascade
on update cascade;