task/3382: Harmonisera tabellnamn #6
|
@ -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
|
||||
@JoinColumn(name = "user_id")
|
||||
@JoinColumn(name = "creator_user_id", referencedColumnName = "id")
|
||||
private User creator;
|
||||
|
||||
@ManyToMany
|
||||
|
|
|
@ -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;
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue
Block a user
Less self describing column name.
creator_id
tells you it is the user who created the template rather than just a genericuser_id
. The referenced table/type is visible from the foreign key/class.