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 13 additions and 12 deletions
Showing only changes of commit 0fb9e6dbc3 - Show all commits

View File

@ -1,11 +1,5 @@
package se.su.dsv.scipro.checklist;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import jakarta.persistence.Basic;
import jakarta.persistence.CollectionTable;
import jakarta.persistence.Column;
@ -16,15 +10,19 @@ import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.JoinTable;
import jakarta.persistence.Lob;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import se.su.dsv.scipro.system.DomainObject;
import se.su.dsv.scipro.system.ProjectType;
import se.su.dsv.scipro.system.User;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
@Entity
@Table(name = "checklist_template")
public class ChecklistTemplate extends DomainObject {
@ -35,12 +33,15 @@ public class ChecklistTemplate extends DomainObject {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Basic
@Column(nullable = false)
private String name;
@Basic(optional = true)
@Column(name = "description")
private String description;
@Basic
@Column(name = "template_number")
private int templateNumber = DEFAULT_TEMPLATE_NUMBER;
@ -51,7 +52,7 @@ public class ChecklistTemplate extends DomainObject {
private List<String> questions = new ArrayList<>(1);
@ManyToOne(optional = false)
tozh4728 marked this conversation as resolved Outdated

Less self describing column name. creator_id tells you it is the user who created the template rather than just a generic user_id. The referenced table/type is visible from the foreign key/class.

Less self describing column name. `creator_id` tells you it is the user who created the template rather than just a generic `user_id`. The referenced table/type is visible from the foreign key/class.
@JoinColumn(name = "user_id")
@JoinColumn(name = "creator_user_id", referencedColumnName = "id")
private User creator;
@ManyToMany

View File

@ -1402,12 +1402,12 @@ alter table `checklist_template_checklist_category`
alter table `checklist_template` drop foreign key `FK14DA6F3E44F4DBE`;
alter table `checklist_template` drop key `FK14DA6F3E44F4DBE`;
alter table `checklist_template` rename column `creator_id` to `user_id`;
alter table `checklist_template` rename column `creator_id` to `creator_user_id`;
alter table `checklist_template` rename column `templateNumber` to `template_number`;
alter table `checklist_template`
add constraint fk_checklist_template_user_id
foreign key (user_id) references user (id)
add constraint fk_checklist_template_creator_user_id
foreign key (creator_user_id) references user (id)
on delete cascade on update cascade;
/*