task/3382: Harmonisera tabellnamn #6
@ -10,7 +10,6 @@ import jakarta.persistence.Table;
|
||||
import se.su.dsv.scipro.system.DomainObject;
|
||||
import se.su.dsv.scipro.system.User;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@ -21,7 +20,7 @@ public class ReviewerTarget extends DomainObject {
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "reviewer_id", nullable = false)
|
||||
@JoinColumn(name = "user_id", nullable = false)
|
||||
tozh4728 marked this conversation as resolved
Outdated
|
||||
private User reviewer;
|
||||
|
||||
@Column(name = "year", nullable = false)
|
||||
|
@ -568,4 +568,24 @@ alter table `comment`
|
||||
foreign key (comment_thread_id)
|
||||
references comment_thread(id)
|
||||
on delete cascade
|
||||
on update cascade;
|
||||
on update cascade;
|
||||
|
||||
-- table: reviewer_target
|
||||
|
||||
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` add constraint uk_reviewer_target_user_id_year unique(user_id, year);
|
||||
|
||||
alter table `reviewer_target`
|
||||
add constraint fk_reviewer_target_user_id
|
||||
foreign key (user_id)
|
||||
references user(id)
|
||||
on delete cascade
|
||||
on update cascade;
|
||||
|
||||
|
||||
NIQUE KEY `UK_ReviewerTarget_ReviewerId_Year` (`reviewer_id`,`year`),
|
||||
CONSTRAINT `FK_ReviewerTarget_ReviewerId` FOREIGN KEY (`reviewer_id`) REFERENCES `user` (`id`)
|
||||
|
Loading…
x
Reference in New Issue
Block a user
Loss of information in the column name, should be
reviewer_user_id
.