task/3382: Harmonisera tabellnamn #6
|
@ -1,9 +1,18 @@
|
|||
package se.su.dsv.scipro.system;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.persistence.Basic;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "external_resource")
|
||||
public class ExternalResource {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
@ -16,6 +25,7 @@ public class ExternalResource {
|
|||
private String url;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
@JoinColumn(name = "project_type_id")
|
||||
private ProjectType relevantFor;
|
||||
|
||||
public ExternalResource() {} // JPA
|
||||
|
|
|
@ -752,9 +752,24 @@ alter table `user_profile_project_type`
|
|||
foreign key (user_profile_id) references user_profile(id)
|
||||
on delete cascade on update cascade;
|
||||
|
||||
-- fix table external_resource except foreign key to table project_type
|
||||
|
||||
alter table `ExternalResource` drop foreign key `ExternalResource_ProjectType_relevantFor`;
|
||||
|
||||
rename table `ExternalResource` to `external_resource`;
|
||||
|
||||
alter table `external_resource` rename column `relevantFor_id` to `project_type_id`;
|
||||
|
||||
|
||||
-- activate following later
|
||||
/*
|
||||
-- add foreign key reference from external_resource to project_type
|
||||
alter table `external_resource`
|
||||
add constraint fk_external_resource_project_type_id
|
||||
foreign key (project_type_id) references project_type(id)
|
||||
on delete cascade on update cascade;
|
||||
|
||||
-- add foreign key reference from user_profile_project_type to project_type.
|
||||
alter table `user_profile_project_type`
|
||||
add constraint fk_user_profile_project_type_project_type_id
|
||||
foreign key (project_type_id) references project_type(id)
|
||||
|
|
Loading…
Reference in New Issue
Block a user