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 28 additions and 2 deletions
Showing only changes of commit f750dad22c - Show all commits

View File

@ -36,7 +36,9 @@ public class MilestoneActivityTemplate extends LazyDeletableDomainObject {
@ManyToMany
@JoinTable(
joinColumns = @JoinColumn(name = "milestone_activity_template_id")
name = "milestone_activity_template_project_type",
joinColumns = @JoinColumn(name = "milestone_activity_template_id"),
inverseJoinColumns = @JoinColumn(name = "project_type_id")
)
private Set<ProjectType> projectTypes = new HashSet<>();

View File

@ -891,16 +891,40 @@ alter table `checklist_template_project_type`
foreign key (checklist_template_id) references checklist_template(id)
on delete cascade on update cascade;
-- table: milestone_activity_template_ProjectType except foreign key to coming table project_type
alter table `milestone_activity_template_ProjectType` drop foreign key `milestone_activity_template_ProjectType_ibfk_1`;
alter table `milestone_activity_template_ProjectType` drop foreign key `FKFB3FC75157F6B071`;
alter table `milestone_activity_template_ProjectType` drop key `FKFB3FC75180E42A0F`;
alter table `milestone_activity_template_ProjectType` drop key `FKFB3FC75157F6B071`;
alter table `milestone_activity_template_ProjectType` drop primary key;
rename table `milestone_activity_template_ProjectType` to `milestone_activity_template_project_type`;
alter table `milestone_activity_template_project_type` rename column `projectTypes_id` to `project_type_id`;
alter table `milestone_activity_template_project_type` add primary key (`milestone_activity_template_id`, `project_type_id`);
alter table `milestone_activity_template_project_type`
add constraint fk_ma_tpt_milestone_activity_template_id
foreign key (milestone_activity_template_id) references milestone_activity_template(id)
on delete cascade on update cascade;
/* Activate following later
-- **********************************************************************************
-- TODO: fix table ProjectType, verify no foreign keys are referenced to ProjectTYpe
-- TODO: fix table ProjectType, verify no foreign keys are referenced to ProjectTYpe before fix it
-- **********************************************************************************
-- Add back all foreign key references to project_typ
-- add foreign key reference from milestone_activity_template_project_type to project_type
alter table `milestone_activity_template_project_type`
add constraint fk_ma_tpt_project_type_id
foreign key (project_type_id) references project_type(id)
on delete cascade on update cascade;
-- add foreign key reference from checklist_template_project_type to project_type
alter table `checklist_template_project_type`
add constraint fk_ct_pt_project_type_id