task/3382: Harmonisera tabellnamn #6
@ -64,7 +64,7 @@ public class User extends LazyDeletableDomainObject {
|
||||
private Set<Program> programs = new HashSet<>();
|
||||
|
||||
@ElementCollection
|
||||
@CollectionTable(name = "user_languages")
|
||||
@CollectionTable(name = "user_language")
|
||||
@Column(name = "language")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Set<Language> languages = EnumSet.noneOf(Language.class);
|
||||
|
@ -424,10 +424,8 @@ alter table `general_system_settings_system_module` add primary key (general_sys
|
||||
|
||||
alter table `general_system_settings_system_module`
|
||||
add constraint fk_general_system_settings_system_module_id
|
||||
foreign key (general_system_settings_id)
|
||||
references general_system_settings(id)
|
||||
on delete cascade
|
||||
on update cascade;
|
||||
foreign key (general_system_settings_id) references general_system_settings(id)
|
||||
on delete cascade on update cascade;
|
||||
|
||||
-- table: general_system_settings_supervisor_change_recipient
|
||||
|
||||
@ -442,10 +440,8 @@ alter table `general_system_settings_supervisor_change_recipient` add primary ke
|
||||
|
||||
alter table `general_system_settings_supervisor_change_recipient`
|
||||
add constraint fk_general_system_settings_supervisor_change_recipient_id
|
||||
foreign key (general_system_settings_id)
|
||||
references general_system_settings(id)
|
||||
on delete cascade
|
||||
on update cascade;
|
||||
foreign key (general_system_settings_id) references general_system_settings(id)
|
||||
on delete cascade on update cascade;
|
||||
|
||||
-- table: general_system_settings_alarm_recipient
|
||||
|
||||
@ -460,10 +456,8 @@ alter table `general_system_settings_alarm_recipient` add primary key (general_s
|
||||
|
||||
alter table `general_system_settings_alarm_recipient`
|
||||
add constraint fk_general_system_settings_alarm_recipient_id
|
||||
foreign key (general_system_settings_id)
|
||||
references general_system_settings(id)
|
||||
on delete cascade
|
||||
on update cascade;
|
||||
foreign key (general_system_settings_id) references general_system_settings(id)
|
||||
on delete cascade on update cascade;
|
||||
|
||||
-- table: general_system_settings
|
||||
|
||||
@ -514,17 +508,13 @@ 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;
|
||||
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;
|
||||
foreign key (user_id) references user(id)
|
||||
on delete cascade on update cascade;
|
||||
|
||||
-- table note
|
||||
|
||||
@ -533,10 +523,8 @@ alter table `note` drop key `user_id`;
|
||||
|
||||
alter table `note`
|
||||
add constraint fk_note_user_id
|
||||
foreign key (user_id)
|
||||
references user(id)
|
||||
on delete cascade
|
||||
on update cascade;
|
||||
foreign key (user_id) references user(id)
|
||||
on delete cascade on update cascade;
|
||||
|
||||
-- table comment & comment_thread
|
||||
|
||||
@ -558,17 +546,13 @@ alter table comment rename column `creator_id` to `user_id`;
|
||||
|
||||
alter table `comment`
|
||||
add constraint fk_comment_user_id
|
||||
foreign key (user_id)
|
||||
references user(id)
|
||||
on delete cascade
|
||||
on update cascade;
|
||||
foreign key (user_id) references user(id)
|
||||
on delete cascade on update cascade;
|
||||
|
||||
alter table `comment`
|
||||
add constraint fk_comment_comment_thread_id
|
||||
foreign key (comment_thread_id)
|
||||
references comment_thread(id)
|
||||
on delete cascade
|
||||
on update cascade;
|
||||
foreign key (comment_thread_id) references comment_thread(id)
|
||||
on delete cascade on update cascade;
|
||||
|
||||
-- table: reviewer_target
|
||||
|
||||
@ -581,10 +565,8 @@ alter table `reviewer_target` add constraint uk_reviewer_target_user_id_year uni
|
||||
|
||||
alter table `reviewer_target`
|
||||
add constraint fk_reviewer_target_user_id
|
||||
foreign key (user_id)
|
||||
references user(id)
|
||||
on delete cascade
|
||||
on update cascade;
|
||||
foreign key (user_id) references user(id)
|
||||
on delete cascade on update cascade;
|
||||
|
||||
-- table: notification_delivery_configuration
|
||||
|
||||
@ -596,10 +578,8 @@ alter table `notification_delivery_configuration` add constraint uk_one_setting_
|
||||
|
||||
alter table `notification_delivery_configuration`
|
||||
add constraint fk_notification_delivery_configuration_user_id
|
||||
foreign key (user_id)
|
||||
references user(id)
|
||||
on delete cascade
|
||||
on update cascade;
|
||||
foreign key (user_id) references user(id)
|
||||
on delete cascade on update cascade;
|
||||
|
||||
-- table: username
|
||||
|
||||
@ -615,10 +595,32 @@ alter table `user_name` add constraint uk_user_name unique(user_name);
|
||||
|
||||
alter table `user_name`
|
||||
add constraint fk_user_name_user_id
|
||||
foreign key (user_id)
|
||||
references user(id)
|
||||
on delete cascade
|
||||
on update cascade;
|
||||
foreign key (user_id) references user(id)
|
||||
on delete cascade on update cascade;
|
||||
|
||||
-- table user_role
|
||||
|
||||
alter table `user_role` drop foreign key `user_role_user_id`;
|
||||
|
||||
alter table `user_role`
|
||||
add constraint fk_user_role_user_id
|
||||
foreign key (user_id) references user(id)
|
||||
on delete cascade on update cascade;
|
||||
|
||||
-- table user_language
|
||||
|
||||
alter table `user_languages` drop foreign key `user_languages_user_id`;
|
||||
alter table `user_languages` drop key `user_languages_user_id`;
|
||||
|
||||
rename table `user_languages` to `user_language`;
|
||||
|
||||
alter table `user_language`
|
||||
add constraint fk_user_language_user_id
|
||||
foreign key (user_id) references user(id)
|
||||
on delete cascade on update cascade;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* the mess with ProjectType
|
||||
@ -644,8 +646,6 @@ alter table `user_name`
|
||||
order by table_name;
|
||||
|
||||
|
||||
|
||||
|
||||
A. Drop FK from following tables
|
||||
|
||||
1. ExternalResource
|
||||
@ -670,4 +670,5 @@ alter table `user_name`
|
||||
1. idea
|
||||
2. project
|
||||
|
||||
D. other tables can be fixed directly.
|
||||
*/
|
Loading…
x
Reference in New Issue
Block a user