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 80 additions and 59 deletions
Showing only changes of commit fcd0a4c8b6 - Show all commits

View File

@ -1,17 +1,30 @@
package se.su.dsv.scipro.match;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import jakarta.persistence.Basic;
import jakarta.persistence.Cacheable;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import se.su.dsv.scipro.system.DomainObject;
import se.su.dsv.scipro.system.ProjectType;
import jakarta.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
@Entity
@Cacheable(true)
@Table(name="ApplicationPeriod")
@Table(name="application_period")
public class ApplicationPeriod extends DomainObject {
@Id
@ -23,17 +36,16 @@ public class ApplicationPeriod extends DomainObject {
private String name;
@Basic
@Column(name = "start_date")
private LocalDate startDate = LocalDate.now();
@Basic
@Column(name = "end_date")
private LocalDate endDate = LocalDate.now();
@Basic
@Column(name = "courseStartDate")
@Column(name = "course_start_date")
private LocalDateTime courseStartDateTime = LocalDate.now().atTime(8, 0);
@Basic
@Column(name = "course_end_date")
private LocalDate courseEndDate;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "applicationPeriod", cascade=CascadeType.ALL, orphanRemoval=true)

View File

@ -1026,7 +1026,7 @@ alter table `activity_template`
foreign key (checklist_template_id) references checklist_template (id)
on delete cascade on update cascade;
-- table: ActivityPlanTemplate (at this stage, no any foreign key is are referenced to ActivityPlanTemplate)
-- table: ActivityPlanTemplate (at this stage, no any foreign key is referenced to ActivityPlanTemplate)
alter table `ActivityPlanTemplate` drop foreign key `FK_rgwf80yvcy2msbb6g80bae10p`;
alter table `ActivityPlanTemplate` drop key `FK_rgwf80yvcy2msbb6g80bae10p`;
@ -1098,18 +1098,22 @@ alter table `idea` drop key `FK6E051897BEC322C1`;
alter table `idea` rename column `applicationPeriod_id` to `application_period_id`;
-- table: ApplicationPeriod, verify no foreign keys are referenced to ApplicationPeriod before fix it
-- table: ApplicationPeriod (at this stage, no any foreign key is referenced to ApplicationPeriod)
rename table `ApplicationPeriod` to `application_period`;
alter table `application_period` rename column `endDate` to `end_date`;
alter table `application_period` rename column `startDate` to `start_date`;
alter table `application_period` rename column `courseStartDate` to `course_start_date`;
alter table `application_period` rename column `courseEndDate` to `course_end_date`;
-- Add back all foreign key references to application_period, since table application_period is ready
/* Activate following later
-- **********************************************************************************
-- TODO: -- Add back all foreign key references to application_period
-- **********************************************************************************
-- add back foreign key reference from ide to application_period
alter table `idea`
add constraint fk_idea_application_period_id
foreign key (application_period_id) references application_period (id)
on delete cascade on update cascade;
-- add back foreign key reference from application_period_exemption to application_period
alter table `application_period_exemption`
@ -1117,6 +1121,8 @@ alter table `application_period_exemption`
foreign key (application_period_id) references application_period (id)
on delete cascade on update cascade;
-- >>> STACK POP: 3rd table group: ApplicationPeriod, applicationperiodexemption, idea is done!!!
-- add back foreign key reference from application_period_project_type to application_period
alter table `application_period_project_type`
add constraint fk_ap_pt_application_period_id
@ -1135,11 +1141,14 @@ alter table `target`
foreign key (application_period_id) references application_period (id)
on delete cascade on update cascade;
-- **********************************************************************************
-- TODO: fix table ProjectType, verify no foreign keys are referenced to ProjectTYpe before fix it
-- **********************************************************************************
-- table: ProjectType (finally!! at this stage, no any foreign key is referenced to ProjectType)
-- >>> STACK POP: 1st table group: target, projectPartner, ApplicationPeriodProjectType is done!!!
/* Activate following later
-- **********************************************************************************
-- TODO: -- Add back all foreign key references to project_type
-- **********************************************************************************