diff --git a/core/src/main/java/se/su/dsv/scipro/reviewing/ReviewerTarget.java b/core/src/main/java/se/su/dsv/scipro/reviewing/ReviewerTarget.java index 2620dea69d..29803d920f 100644 --- a/core/src/main/java/se/su/dsv/scipro/reviewing/ReviewerTarget.java +++ b/core/src/main/java/se/su/dsv/scipro/reviewing/ReviewerTarget.java @@ -1,5 +1,6 @@ package se.su.dsv.scipro.reviewing; +import jakarta.persistence.Basic; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; @@ -19,22 +20,26 @@ public class ReviewerTarget extends DomainObject { @GeneratedValue(strategy = jakarta.persistence.GenerationType.IDENTITY) private Long id; - @ManyToOne(optional = false) - @JoinColumn(name = "user_id", nullable = false) - private User reviewer; - + @Basic @Column(name = "year", nullable = false) private int year; + @Basic @Column(name = "spring", nullable = false) private int spring; + @Basic @Column(name = "autumn", nullable = false) private int autumn; + @Basic @Column(name = "note") private String note; + @ManyToOne(optional = false) + @JoinColumn(name = "reviewer_user_id", referencedColumnName = "id", nullable = false) + private User reviewer; + @Override public Long getId() { return id; diff --git a/core/src/main/resources/db/migration/V390__harmonize_table_attribute_name.sql b/core/src/main/resources/db/migration/V390__harmonize_table_attribute_name.sql index 789534a9f6..906ea5a9c0 100644 --- a/core/src/main/resources/db/migration/V390__harmonize_table_attribute_name.sql +++ b/core/src/main/resources/db/migration/V390__harmonize_table_attribute_name.sql @@ -555,13 +555,13 @@ alter table `comment` alter table `reviewer_target` drop foreign key `FK_ReviewerTarget_ReviewerId`; alter table `reviewer_target` drop key `UK_ReviewerTarget_ReviewerId_Year`; -alter table `reviewer_target` rename column `reviewer_id` to `user_id`; +alter table `reviewer_target` rename column `reviewer_id` to `reviewer_user_id`; -alter table `reviewer_target` add constraint uk_reviewer_target_user_id_year unique(user_id, year); +alter table `reviewer_target` add constraint uk_reviewer_target_reviewer_user_id_year unique(reviewer_user_id, year); alter table `reviewer_target` - add constraint fk_reviewer_target_user_id - foreign key (user_id) references user (id) + add constraint fk_reviewer_target_reviewer_user_id + foreign key (reviewer_user_id) references user (id) on delete cascade on update cascade; -- table: notification_delivery_configuration