task/3382: Harmonisera tabellnamn #6

Merged
ansv7779 merged 104 commits from task/3382 into develop 2024-11-12 13:33:44 +01:00
2 changed files with 22 additions and 3 deletions
Showing only changes of commit 76015ef660 - Show all commits

View File

@ -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

Loss of information in the column name, should be reviewer_user_id.

Loss of information in the column name, should be `reviewer_user_id`.
private User reviewer;
@Column(name = "year", nullable = false)

View File

@ -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`)