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 33 additions and 7 deletions
Showing only changes of commit d92adb281f - Show all commits

View File

@ -4,7 +4,7 @@ import jakarta.persistence.*;
import java.util.Objects;
@Entity
@Table(name = "Program")
@Table(name = "program")
public class Program extends DomainObject {
@Id
@ -12,13 +12,13 @@ public class Program extends DomainObject {
@Column(name = "id")
private Long id;
@Column(name = "externalId")
@Column(name = "external_id")
private Integer externalId;
@Column(name = "name")
@Column(name = "name_sv")
private String name;
@Column(name = "nameEn", nullable = true)
@Column(name = "name_en", nullable = true)
private String nameEn;
@Column(name = "code")

View File

@ -489,13 +489,39 @@ alter table `general_system_settings` rename column `externalGradingURL` to `ext
alter table `general_system_settings` rename column `finalSurveyAvailable` to `final_survey_available`;
alter table `general_system_settings` rename column `activeProjectIdeaSupportMail` to `active_project_idea_support_mail`;
/*
* Step 5: table user and related tables.
*
* Table user is one of four fundamental tables (other three: project, file_reference, ProjectType). All four
* tables have many foreign keys referenced to them.
*
* Related tables of table user are the tables which have no relationship with other three fundamental tables. Their
* foreign key references end at table user.
*/
-- table Program and user_program
alter table `user_program` drop foreign key `user_program_program_id`;
alter table `user_program` drop key `user_program_program_id`;
alter table `user_program` drop foreign key `user_program_user_id`;
rename table `Program` to `program`;
alter table `program` rename column `externalId` to `external_id`;
alter table `program` rename column `name` to `name_sv`;
alter table `program` rename column `nameEn` to `name_en`;
alter table `user_program`
add constraint fk_user_program_program_id
foreign key (program_id)
references program(id)
on delete cascade
on update cascade;
alter table `user_program`
add constraint fk_user_program_user_id
foreign key (user_id)
references user(id)
on delete cascade
on update cascade;