Squash and fix migrations so they run against an empty schema #24

Merged
tozh4728 merged 3 commits from empty-database-migration into develop 2024-12-02 10:31:21 +01:00
451 changed files with 2920 additions and 15662 deletions

View File

@ -234,14 +234,8 @@ public class DataInitializer implements Lifecycle {
}
private void createGradingCriterionTemplateIfNotDone() {
save(getBachelorTemplate());
save(getBachelorTemplate());
save(getBachelorTemplate());
save(getMasterTemplate());
save(getMasterTemplate());
save(getMasterTemplate());
save(getMagisterTemplate());
save(getMagisterTemplate());
save(getMagisterTemplate());
}

View File

@ -1 +0,0 @@
ALTER TABLE `checklist` ADD COLUMN `description` LONGTEXT DEFAULT NULL;

View File

@ -1 +0,0 @@
ALTER TABLE `file_description` MODIFY COLUMN `type` VARCHAR(255);

View File

@ -1 +0,0 @@
insert into Event values ('FinalSeminarCreated','Final seminar created');

View File

@ -1,2 +0,0 @@
ALTER TABLE `file_description` ADD CONSTRAINT `file_description_user` FOREIGN KEY (`userId`) REFERENCES `user` (`id`);
ALTER TABLE `file_description` DROP COLUMN `data`;

View File

@ -1 +0,0 @@
ALTER TABLE `file_description` DROP COLUMN `targetLastModified`;

View File

@ -1,39 +0,0 @@
create temporary table `remove_checklists` (id bigint);
insert into remove_checklists
select checklist_id from checklist_checklist_category
where categories_id = (select id from checklist_category where categoryName = 'Supervisor')
and checklist_id not in (select checklist_id from checklist_checklist_category
where categories_id not in (select id from checklist_category where categoryName = 'Supervisor'));
create temporary table `remove_answers` (id bigint);
insert into remove_answers select answers_id from checklist_question_checklist_answer where checklist_question_id in
(select questions_id from checklist_checklist_question where checklist_id in (select id from remove_checklists));
delete from checklist_question_checklist_answer where checklist_question_id in
(select questions_id from checklist_checklist_question where checklist_id in
(select id from remove_checklists));
delete from checklist_answer where id in
(select id from remove_answers);
create temporary table `remove_questions` (id bigint);
insert into remove_questions select questions_id from checklist_checklist_question where checklist_id in
(select id from remove_checklists);
delete from checklist_checklist_question where checklist_id in (select id from remove_checklists);
delete from checklist_question where id in (select id from remove_questions);
delete from checklist_checklist_category where checklist_id in (select id from remove_checklists);
delete from Checklist_userLastOpenDate where CheckList_id in (select id from remove_checklists);
delete from project_checklist where checkLists_id in (select id from remove_checklists);
UPDATE project_schedule_event
SET checkList_id = NULL
WHERE checkList_id in (select id from remove_checklists);
delete from checklist where id in (select id from remove_checklists);

View File

@ -1,19 +0,0 @@
create temporary table `remove_checklist_templates` (id bigint);
insert into remove_checklist_templates
select checklist_template_id from checklist_template_checklist_category
where categories_id = (select id from checklist_category where categoryName = 'Supervisor')
and checklist_template_id not in (select checklist_id from checklist_checklist_category
where categories_id not in (select id from checklist_category where categoryName = 'Supervisor'));
delete from ChecklistTemplate_questions where CheckListTemplate_id in (select id from remove_checklist_templates);
delete from checklist_template_checklist_category where checklist_template_id in (select id from remove_checklist_templates);
update peer_request set checkListTemplate_id = NULL where checkListTemplate_id in (select id from remove_checklist_templates);
update project_event_template set checkListTemplate_id = NULL where checkListTemplate_id in (select id from remove_checklist_templates);
delete from checklist_template_ProjectType where checklist_template_id in (select id from remove_checklist_templates);
delete from checklist_template where id in (select id from remove_checklist_templates);
delete from checklist_category where categoryName = 'Supervisor';

View File

@ -1 +0,0 @@
ALTER TABLE `file_description` ADD COLUMN `deletable` BOOLEAN NOT NULL DEFAULT FALSE;

View File

@ -1,43 +0,0 @@
CREATE TABLE IF NOT EXISTS `AnnualReview` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL,
`year` int(4) NOT NULL,
`annualReview_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_1lixh18i7nf77ewo7kbcpp0s2` (`annualReview_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
ALTER TABLE `AnnualReview`
ADD CONSTRAINT `FK_1lixh18i7nf77ewo7kbcpp0s2` FOREIGN KEY (`annualReview_id`) REFERENCES `file_description` (`id`);
CREATE TABLE IF NOT EXISTS `PhD` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL,
`basicContract_id` bigint(20) DEFAULT NULL,
`project_id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_ulti91hg79n6uve40ypk4ep8` (`project_id`),
KEY `FK_gjws84yb3jwcjtsl566p7elwt` (`basicContract_id`),
KEY `FK_ulti91hg79n6uve40ypk4ep8` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
ALTER TABLE `PhD`
ADD CONSTRAINT `FK_ulti91hg79n6uve40ypk4ep8` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`),
ADD CONSTRAINT `FK_gjws84yb3jwcjtsl566p7elwt` FOREIGN KEY (`basicContract_id`) REFERENCES `file_description` (`id`);
CREATE TABLE IF NOT EXISTS `PhD_AnnualReview` (
`PhD_id` bigint(20) NOT NULL,
`annualReviews_id` bigint(20) NOT NULL,
PRIMARY KEY (`PhD_id`,`annualReviews_id`),
UNIQUE KEY `UK_s7qfudoo5kkayljbmyyssfywi` (`annualReviews_id`),
KEY `FK_s7qfudoo5kkayljbmyyssfywi` (`annualReviews_id`),
KEY `FK_8gpidcs94cr95v2mgk5be6x8b` (`PhD_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `PhD_AnnualReview`
ADD CONSTRAINT `FK_8gpidcs94cr95v2mgk5be6x8b` FOREIGN KEY (`PhD_id`) REFERENCES `PhD` (`id`),
ADD CONSTRAINT `FK_s7qfudoo5kkayljbmyyssfywi` FOREIGN KEY (`annualReviews_id`) REFERENCES `AnnualReview` (`id`);

View File

@ -1,4 +0,0 @@
ALTER TABLE `AnnualReview` CONVERT TO CHARACTER SET utf8;
ALTER TABLE `PhD` CONVERT TO CHARACTER SET utf8;
ALTER TABLE `PhD_AnnualReview` CONVERT TO CHARACTER SET utf8;
ALTER TABLE `ApplicationPeriodProjectType` CONVERT TO CHARACTER SET utf8;

View File

@ -1,3 +0,0 @@
ALTER TABLE `grading_report_template` MODIFY COLUMN `description` VARCHAR(2000);
ALTER TABLE `grading_question` MODIFY COLUMN `description` VARCHAR(2000);
ALTER TABLE `grading_answer` ADD COLUMN `feedback` VARCHAR(2000);

View File

@ -1,2 +0,0 @@
update project set dateCreated = daisyStartDate where dateCreated is null;
alter table project drop column daisyStartDate;

View File

@ -1,2 +0,0 @@
ALTER TABLE `NotificationData` DROP FOREIGN KEY `FK2DCAC3554D07E0A9`;
ALTER TABLE `NotificationData` ADD CONSTRAINT `FK2DCAC3554D07E0A9` FOREIGN KEY (`seminar_id`) REFERENCES `final_seminar` (`id`) ON DELETE CASCADE;

View File

@ -1,6 +0,0 @@
CREATE TABLE `project_type_modules` (
`ProjectType_id` bigint(20) NOT NULL,
`modules` varchar(255) DEFAULT NULL,
KEY `FK_4attsf1e22qpveesgl6o9b7lg` (`ProjectType_id`),
CONSTRAINT `FK_4attsf1e22qpveesgl6o9b7lg` FOREIGN KEY (`ProjectType_id`) REFERENCES `ProjectType` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,5 +0,0 @@
RENAME TABLE `PhD` TO `StudyPlan`;
ALTER TABLE `AnnualReview` ADD COLUMN `studyPlan_id` BIGINT(20);
ALTER TABLE `AnnualReview` ADD CONSTRAINT `FK_annual_review_study_plan` FOREIGN KEY (`studyPlan_id`) REFERENCES `StudyPlan` (`id`);
UPDATE `AnnualReview` SET `studyPlan_id` = (SELECT `PhD_id` FROM `PhD_AnnualReview` WHERE `annualReviews_id` = `AnnualReview`.`id`);
DROP TABLE `PhD_AnnualReview`;

View File

@ -1,3 +0,0 @@
ALTER TABLE `projectPartner` DROP FOREIGN KEY `FK_projectPartner_projectType`;
ALTER TABLE `projectPartner` DROP KEY `FK_projectPartner_projectType`;
ALTER TABLE `projectPartner` DROP `projectType_id`;

View File

@ -1,5 +0,0 @@
ALTER TABLE `final_seminar_active_participation` ADD COLUMN `user_id` BIGINT(20) NOT NULL;
UPDATE `final_seminar_active_participation` SET `user_id` = (SELECT `user_id` FROM `role` WHERE `role`.`id` = `student_id`);
ALTER TABLE `final_seminar_active_participation` ADD CONSTRAINT `final_seminar_active_participation_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `final_seminar_active_participation` DROP FOREIGN KEY `FK_active_participation_student_id`;
ALTER TABLE `final_seminar_active_participation` DROP COLUMN `student_id`;

View File

@ -1,5 +0,0 @@
ALTER TABLE `milestone` ADD COLUMN `user_id` BIGINT(20) DEFAULT NULL;
UPDATE `milestone` SET `user_id` = (SELECT `user_id` FROM `role` WHERE `id` = `student_id` AND `student_id` IS NOT NULL);
ALTER TABLE `milestone` ADD CONSTRAINT `milestone_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `milestone` DROP FOREIGN KEY `FKC08419709BD14DD5`;
ALTER TABLE `milestone` DROP COLUMN `student_id`;

View File

@ -1,5 +0,0 @@
ALTER TABLE `project` ADD COLUMN `supervisor_id` BIGINT(20) DEFAULT NULL;
UPDATE `project` SET `supervisor_id` = (SELECT `user_id` FROM `role` WHERE `id` = `headSupervisor_id`);
ALTER TABLE `project` ADD CONSTRAINT `project_supervisor_id` FOREIGN KEY (`supervisor_id`) REFERENCES `user` (`id`);
ALTER TABLE `project` DROP FOREIGN KEY `FK_6k74jgcmji5vo3lheg4npoaql`;
ALTER TABLE `project` DROP COLUMN `headSupervisor_id`;

View File

@ -1,5 +0,0 @@
ALTER TABLE `project_follower` ADD COLUMN `user_id` BIGINT(20) NOT NULL;
UPDATE `project_follower` SET `user_id` = (SELECT `user_id` FROM `role` WHERE `id` = `follower_id`);
ALTER TABLE `project_follower` ADD CONSTRAINT `project_follower_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `project_follower` DROP FOREIGN KEY `FK_h49g8tc2d8q69y3i66nj404h7`;
ALTER TABLE `project_follower` DROP COLUMN `follower_id`;

View File

@ -1,6 +0,0 @@
ALTER TABLE `peer_review` DROP FOREIGN KEY `FK_9xy59w1sbydtuplendcthlhu5`;
ALTER TABLE `peer_review` CHANGE COLUMN `reviewer_id` `foo` BIGINT(20) NOT NULL;
ALTER TABLE `peer_review` ADD COLUMN `reviewer_id` BIGINT(20) NOT NULL;
UPDATE `peer_review` SET `reviewer_id` = (SELECT `user_id` FROM `role` WHERE `id` = `foo`);
ALTER TABLE `peer_review` ADD CONSTRAINT `peer_review_reviewer_id` FOREIGN KEY (`reviewer_id`) REFERENCES `user` (`id`);
ALTER TABLE `peer_review` DROP COLUMN `foo`;

View File

@ -1,6 +0,0 @@
ALTER TABLE `peer_request` DROP FOREIGN KEY `FK_ihqq9n3eb7ycvd5ggjxx5wn38`;
ALTER TABLE `peer_request` CHANGE COLUMN `requester_id` `foo` BIGINT(20) NOT NULL;
ALTER TABLE `peer_request` ADD COLUMN `requester_id` BIGINT(20) NOT NULL;
UPDATE `peer_request` SET `requester_id` = (SELECT `user_id` FROM `role` WHERE `id` = `foo`);
ALTER TABLE `peer_request` ADD CONSTRAINT `peer_request_reviewer_id` FOREIGN KEY (`requester_id`) REFERENCES `user` (`id`);
ALTER TABLE `peer_request` DROP COLUMN `foo`;

View File

@ -1,7 +0,0 @@
ALTER TABLE `applicationperiodexemption` ADD COLUMN `user_id` BIGINT(20) NOT NULL;
UPDATE `applicationperiodexemption` SET `user_id` = (SELECT `user_id` FROM `role` WHERE `id` = `studentId`);
ALTER TABLE `applicationperiodexemption` ADD CONSTRAINT `applicationperiodexemption_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `applicationperiodexemption` DROP FOREIGN KEY `FKCB7E71913353DC5C`;
ALTER TABLE `applicationperiodexemption` DROP PRIMARY KEY;
ALTER TABLE `applicationperiodexemption` ADD PRIMARY KEY (`user_id`, `applicationPeriodId`);
ALTER TABLE `applicationperiodexemption` DROP COLUMN `studentId`;

View File

@ -1,5 +0,0 @@
ALTER TABLE `idea_student` ADD COLUMN `user_id` BIGINT(20) NOT NULL;
UPDATE `idea_student` SET `user_id` = (SELECT `user_id` FROM `role` WHERE `id` = `role_id`);
ALTER TABLE `idea_student` ADD CONSTRAINT `idea_student_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `idea_student` DROP FOREIGN KEY `FK9458BA932B6C61BA`;
ALTER TABLE `idea_student` DROP COLUMN `role_id`;

View File

@ -1,6 +0,0 @@
ALTER TABLE `idea_match` DROP FOREIGN KEY `FK87EA481DBCA56165`;
ALTER TABLE `idea_match` CHANGE COLUMN `supervisor_id` `foo` BIGINT(20) DEFAULT NULL;
ALTER TABLE `idea_match` ADD COLUMN `supervisor_id` BIGINT(20) DEFAULT NULL;
UPDATE `idea_match` SET `supervisor_id` = (SELECT `user_id` FROM `role` WHERE `id` = `foo`);
ALTER TABLE `idea_match` ADD CONSTRAINT `idea_match_supervisor_id` FOREIGN KEY (`supervisor_id`) REFERENCES `user` (`id`);
ALTER TABLE `idea_match` DROP COLUMN `foo`;

View File

@ -1,7 +0,0 @@
ALTER TABLE `target` ADD COLUMN `user_id` BIGINT(20) NOT NULL;
UPDATE `target` SET `user_id` = (SELECT `user_id` FROM `role` WHERE `id` = `employeeId`);
ALTER TABLE `target` ADD CONSTRAINT `target_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `target` DROP FOREIGN KEY `FKCB7E71913353DC5Cb`;
ALTER TABLE `target` DROP PRIMARY KEY;
ALTER TABLE `target` ADD PRIMARY KEY (`user_id`, `applicationPeriodId`, `projectTypeId`);
ALTER TABLE `target` DROP COLUMN `employeeId`;

View File

@ -1,13 +0,0 @@
CREATE TABLE `user_program` (
`user_id` BIGINT(20) NOT NULL,
`program_id` BIGINT(20) NOT NULL,
PRIMARY KEY (`user_id`, `program_id`),
CONSTRAINT `user_program_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT `user_program_program_id` FOREIGN KEY (`program_id`) REFERENCES `Program` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `user_program` (`user_id`, `program_id`)
SELECT `user`.`id`, `role_Program`.`programs_id`
FROM `role_Program`
INNER JOIN `role` ON `role`.`id` = `role_Program`.`role_id`
INNER JOIN `user` ON `user`.`id` = `role`.`user_id`;

View File

@ -1,6 +0,0 @@
ALTER TABLE `final_seminar` DROP FOREIGN KEY `FK49900D2873048D7F`;
ALTER TABLE `final_seminar` CHANGE COLUMN `examiner_id` `foo` BIGINT(20) DEFAULT NULL;
ALTER TABLE `final_seminar` ADD COLUMN `examiner_id` BIGINT(20) DEFAULT NULL;
UPDATE `final_seminar` SET `examiner_id` = (SELECT `user_id` FROM `role` WHERE `id` = `foo`);
ALTER TABLE `final_seminar` ADD CONSTRAINT `final_seminar_examiner_id` FOREIGN KEY (`examiner_id`) REFERENCES `user` (`id`);
ALTER TABLE `final_seminar` DROP COLUMN `foo`;

View File

@ -1,6 +0,0 @@
DROP TABLE `role_Program`;
DROP TABLE `Employee_Language`;
DROP TABLE `employee_researcharea`;
DROP TABLE `SupervisorNotificationSettings`;
DROP TABLE `project_student`;
DROP TABLE `role`;

View File

@ -1,13 +0,0 @@
CREATE TABLE `user_language` (
`user_id` BIGINT(20) NOT NULL,
`language_id` BIGINT(20) NOT NULL,
PRIMARY KEY (`user_id`, `language_id`),
CONSTRAINT `user_language_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT `user_language_language_id` FOREIGN KEY (`language_id`) REFERENCES `Language` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `user_language` (`user_id`, `language_id`)
SELECT `user`.`id`, `Employee_Language`.`languages_id`
FROM `Employee_Language`
INNER JOIN `role` ON `role`.`id` = `Employee_Language`.`role_id`
INNER JOIN `user` ON `user`.`id` = `role`.`user_id`;

View File

@ -1,13 +0,0 @@
CREATE TABLE `user_research_area` (
`user_id` BIGINT(20) NOT NULL,
`research_area_id` BIGINT(20) NOT NULL,
PRIMARY KEY (`user_id`, `research_area_id`),
CONSTRAINT `user_research_area_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT `user_research_area_research_area_id` FOREIGN KEY (`research_area_id`) REFERENCES `researcharea` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `user_research_area` (`user_id`, `research_area_id`)
SELECT `user`.`id`, `employee_researcharea`.`researchAreas_id`
FROM `employee_researcharea`
INNER JOIN `role` ON `role`.`id` = `employee_researcharea`.`role_id`
INNER JOIN `user` ON `user`.`id` = `role`.`user_id`;

View File

@ -1,3 +0,0 @@
ALTER TABLE `user` ADD COLUMN `unit_id` BIGINT(20) DEFAULT NULL;
ALTER TABLE `user` ADD CONSTRAINT `user_unit_id` FOREIGN KEY (`unit_id`) REFERENCES `unit` (`id`);
UPDATE `user` SET `unit_id` = (SELECT `unit_id` FROM `role` WHERE `user_id` = `user`.`id` AND `unit_id` IS NOT NULL);

View File

@ -1,11 +0,0 @@
CREATE TABLE `user_role` (
`user_id` BIGINT(20) NOT NULL,
`role` VARCHAR(255) NOT NULL,
PRIMARY KEY (`user_id`, `role`),
CONSTRAINT `user_role_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `user_role` (`user_id`, `role`)
SELECT `user_id`, UPPER(`rolename`)
FROM `role`;

View File

@ -1,12 +0,0 @@
CREATE TABLE `project_user` (
`user_id` BIGINT(20) NOT NULL,
`project_id` BIGINT(20) NOT NULL,
PRIMARY KEY (`user_id`, `project_id`),
CONSTRAINT `project_user_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT `project_user_project_id` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `project_user` (`user_id`, `project_id`)
SELECT `role`.`user_id`, `project_student`.`project_id`
FROM `project_student`
INNER JOIN `role` ON `role`.`id` = `project_student`.`projectParticipants_id`;

View File

@ -1,5 +0,0 @@
ALTER TABLE `SupervisorGradingReport` ADD COLUMN `user_id` BIGINT(20) NOT NULL;
UPDATE `SupervisorGradingReport` SET `user_id` = (SELECT `user_id` FROM `role` WHERE `role`.`id` = `student_id`);
ALTER TABLE `SupervisorGradingReport` ADD CONSTRAINT `supervisor_grading_report_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `SupervisorGradingReport` DROP FOREIGN KEY `FK_2vi1wacprhrqlc8agx08btx34`;
ALTER TABLE `SupervisorGradingReport` DROP COLUMN `student_id`;

View File

@ -1,5 +0,0 @@
ALTER TABLE `final_seminar_respondent` ADD COLUMN `user_id` BIGINT(20) NOT NULL;
UPDATE `final_seminar_respondent` SET `user_id` = (SELECT `user_id` FROM `role` WHERE `role`.`id` = `student_id`);
ALTER TABLE `final_seminar_respondent` ADD CONSTRAINT `final_seminar_respondent_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `final_seminar_respondent` DROP FOREIGN KEY `FK_student_respondent_id`;
ALTER TABLE `final_seminar_respondent` DROP COLUMN `student_id`;

View File

@ -1,5 +0,0 @@
ALTER TABLE `final_seminar_opposition` ADD COLUMN `user_id` BIGINT(20) NOT NULL;
UPDATE `final_seminar_opposition` SET `user_id` = (SELECT `user_id` FROM `role` WHERE `role`.`id` = `student_id`);
ALTER TABLE `final_seminar_opposition` ADD CONSTRAINT `final_seminar_opposition_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE `final_seminar_opposition` DROP FOREIGN KEY `FK_opposition_student_id`;
ALTER TABLE `final_seminar_opposition` DROP COLUMN `student_id`;

View File

@ -1,6 +0,0 @@
ALTER TABLE `schedule_template` DROP FOREIGN KEY `FK_schedule_template_projectType`;
ALTER TABLE `schedule_template` DROP COLUMN `projectType_id`;
ALTER TABLE `project_event_template` DROP FOREIGN KEY `FK_p8buy8evr4g6u8nkbml0mdf1v`;
ALTER TABLE `project_event_template` DROP COLUMN `templateCreator_id`;
ALTER TABLE `project_event_template` DROP COLUMN `estimatedTimeConsumption`;

View File

@ -1,2 +0,0 @@
ALTER TABLE `checklist_template`
DROP `numberOfQuestions`;

View File

@ -1 +0,0 @@
ALTER TABLE `grading_report_template` ADD COLUMN `credits` INT(11);

View File

@ -1,3 +0,0 @@
ALTER TABLE `project_schedule_event` DROP FOREIGN KEY `creator_id_index`;
ALTER TABLE `project_schedule_event` DROP KEY `creator_id_index`;
ALTER TABLE `project_schedule_event` DROP `creator_id`;

View File

@ -1 +0,0 @@
RENAME TABLE `grading_question` TO `grading_criterion`;

View File

@ -1,37 +0,0 @@
CREATE TABLE IF NOT EXISTS `project_reviewer` (
`project_id` bigint(20) NOT NULL,
`user_id` bigint(20) NOT NULL,
PRIMARY KEY (`project_id`,`user_id`),
KEY `FK_g7yryw3e0dtmuuvgw5qjhphjm` (`user_id`),
KEY `FK_6aik0jd18kv3383fbt09xd0pi` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `project_reviewer`
ADD CONSTRAINT `FK_6aik0jd18kv3383fbt09xd0pi` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`),
ADD CONSTRAINT `FK_g7yryw3e0dtmuuvgw5qjhphjm` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
INSERT INTO `project_reviewer` (`user_id`, `project_id`) (
SELECT `user_id` , `project_id`
FROM `project_follower`
WHERE `projectRole` = 'REVIEWER'
);
CREATE TABLE IF NOT EXISTS `project_cosupervisor` (
`user_id` bigint(20) NOT NULL,
`project_id` bigint(20) NOT NULL,
PRIMARY KEY (`user_id`,`project_id`),
KEY `FK_18x2poxkt8s2bw9kpr7vbmd5j` (`user_id`),
KEY `FK_fj57t069dymdrnnhdxcnfvvnn` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `project_cosupervisor`
ADD CONSTRAINT `FK_fj57t069dymdrnnhdxcnfvvnn` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`),
ADD CONSTRAINT `FK_18x2poxkt8s2bw9kpr7vbmd5j` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
INSERT INTO `project_cosupervisor` (`user_id`, `project_id`) (
SELECT DISTINCT `user_id` , `project_id`
FROM `project_follower`
WHERE `projectRole` = 'CO_SUPERVISOR'
);
DROP TABLE `project_follower`;

View File

@ -1,16 +0,0 @@
CREATE TABLE `user_languages` (
`user_id` bigint(20) NOT NULL,
`languages` varchar(255) DEFAULT NULL,
KEY `user_languages_user_id` (`user_id`),
CONSTRAINT `user_languages_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `user_languages` (`user_id`, `languages`) SELECT `user_id`, UPPER(`Language`.`name`)
FROM `user_language` INNER JOIN `Language` ON `Language`.`id` = `user_language`.`language_id`;
DROP TABLE `user_language`;
ALTER TABLE `idea` DROP FOREIGN KEY `FK6E0518973BE9881F`;
ALTER TABLE `idea` ADD COLUMN `language` VARCHAR(255) DEFAULT NULL;
UPDATE `idea` SET `language` = (SELECT UPPER(`name`) FROM `Language` where `id` = language_id);
ALTER TABLE `idea` DROP COLUMN `language_id`;

View File

@ -1 +0,0 @@
ALTER TABLE `answer` CHANGE COLUMN `freeTextAnswer` `motivation` LONGTEXT;

View File

@ -1 +0,0 @@
DROP TABLE review_rating;

View File

@ -1 +0,0 @@
ALTER TABLE `general_system_settings` DROP COLUMN `peerRatingsEnabled`;

View File

@ -1 +0,0 @@
ALTER TABLE `project_type_settings` DROP COLUMN `numDaysBeforePeerRequestPriority`;

View File

@ -1 +0,0 @@
ALTER TABLE `file_description` DROP COLUMN `isThesisFile`;

View File

@ -1 +0,0 @@
ALTER TABLE `file_description` ADD COLUMN `fileSource` VARCHAR(255);

View File

@ -1,2 +0,0 @@
ALTER TABLE `criterion` MODIFY COLUMN `feedback` LONGTEXT DEFAULT NULL;
ALTER TABLE `GradingCriterion` MODIFY COLUMN `feedback` LONGTEXT DEFAULT NULL;

View File

@ -1,27 +0,0 @@
RENAME TABLE `schedule_template` TO `ActivityPlanTemplate`;
RENAME TABLE `project_event_template` TO `ActivityTemplate`;
ALTER TABLE `ActivityTemplate` DROP FOREIGN KEY `FK_ca5bhq3i6p2g292fo5l4fqtf`;
ALTER TABLE `ActivityTemplate` DROP KEY `FKD4434665C5FC509F`;
ALTER TABLE `ActivityTemplate` CHANGE `scheduleTemplate_id` `activityPlanTemplate_id` bigint(20) DEFAULT NULL;
ALTER TABLE `ActivityTemplate` ADD KEY `FKD4434665C5FC509F` (`activityPlanTemplate_id`);
ALTER TABLE `ActivityTemplate` ADD CONSTRAINT `FK_ca5bhq3i6p2g292fo5l4fqtf` FOREIGN KEY (`activityPlanTemplate_id`) REFERENCES `ActivityPlanTemplate` (`id`);
ALTER TABLE `ApplicationPeriodProjectType` DROP FOREIGN KEY `FK_3ku67jvegs1xxh8ykk023i7sb`;
ALTER TABLE `ApplicationPeriodProjectType` DROP KEY `FK_3ku67jvegs1xxh8ykk023i7sb`;
ALTER TABLE `ApplicationPeriodProjectType` CHANGE `scheduleTemplate_id` `activityPlanTemplate_id` bigint(20) DEFAULT NULL;
ALTER TABLE `ApplicationPeriodProjectType` ADD KEY `FK_3ku67jvegs1xxh8ykk023i7sb` (`activityPlanTemplate_id`);
ALTER TABLE `ApplicationPeriodProjectType` ADD CONSTRAINT `FK_3ku67jvegs1xxh8ykk023i7sb` FOREIGN KEY (`activityPlanTemplate_id`) REFERENCES `ActivityPlanTemplate` (`id`);
ALTER TABLE `ActivityPlanTemplate` CHANGE `templateDescription` `description` longtext;
ALTER TABLE `ActivityPlanTemplate` CHANGE `templateName` `title` varchar(255) NOT NULL;
RENAME TABLE `project_schedule` TO `ActivityPlan`;
RENAME TABLE `project_schedule_event` TO `Activity`;
ALTER TABLE `Activity` DROP FOREIGN KEY `projectSchedule_id_index`;
ALTER TABLE `Activity` DROP KEY `projectSchedule_id_index`;
ALTER TABLE `Activity` CHANGE `projectSchedule_id` `activityTemplate_id` bigint(20) NOT NULL;
ALTER TABLE `Activity` ADD KEY `activityTemplate_id_index` (`activityTemplate_id`);
ALTER TABLE `Activity` ADD CONSTRAINT `activityTemplate_id_index` FOREIGN KEY (`activityTemplate_id`) REFERENCES `ActivityPlan` (`id`);
ALTER TABLE `Activity` CHANGE `name` `title` varchar(500) NOT NULL;

View File

@ -1 +0,0 @@
ALTER TABLE `grading_report` ADD COLUMN `finished` BOOLEAN DEFAULT FALSE NOT NULL;

View File

@ -1,3 +0,0 @@
UPDATE Notification
SET absoluteURL = REPLACE(absoluteURL, '&checklist=', '&clid=')
WHERE absoluteURL LIKE '%&checklist=%';

View File

@ -1,7 +0,0 @@
UPDATE Notification
SET absoluteURL = REPLACE(absoluteURL, '&tid=', '&ftid=')
WHERE absoluteURL LIKE '%&tid=%';
UPDATE Notification
SET absoluteURL = REPLACE(absoluteURL, '&postID=', '&fpid=')
WHERE absoluteURL LIKE '%&postID=%';

View File

@ -1,5 +0,0 @@
ALTER TABLE `opposition_report` ADD `attachment_id` bigint(20) DEFAULT NULL;
ALTER TABLE `opposition_report` ADD CONSTRAINT `opposition_report_attachment_id` FOREIGN KEY (`attachment_id`) REFERENCES `file_description` (`id`);
ALTER TABLE `preliminary_grading_report` ADD `attachment_id` bigint(20) DEFAULT NULL;
ALTER TABLE `preliminary_grading_report` ADD CONSTRAINT `preliminary_grading_report_attachment_id` FOREIGN KEY (`attachment_id`) REFERENCES `file_description` (`id`);

View File

@ -1,13 +0,0 @@
CREATE TABLE `research_plan` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL,
`project_id` bigint(20) NOT NULL,
`file_id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `research_plan_project` (`project_id`),
KEY `research_plan_file` (`file_id`),
CONSTRAINT `research_plan_project` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`),
CONSTRAINT `research_plan_file` FOREIGN KEY (`file_id`) REFERENCES `file_description` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,22 +0,0 @@
CREATE TABLE IF NOT EXISTS `externallink` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL,
`url` varchar(255) NOT NULL,
`project_id` bigint(20) NOT NULL,
`user_id` bigint(20) NOT NULL,
`description` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK_PROJECT` (`project_id`),
KEY `FK_USER` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
ALTER TABLE `externallink`
ADD CONSTRAINT `FK_USER` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
ADD CONSTRAINT `FK_PROJECT` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`);
INSERT INTO `externallink` (`dateCreated`, `lastModified`, `version`, `url`, `project_id`, `user_id`)
SELECT `thesislink`.`dateCreated`, `thesislink`.`lastModified`, `thesislink`.`version`, `thesislink`.`URL`, `thesislink`.`project_id`, `project`.`supervisor_id`
FROM `thesislink`, `project`
WHERE `thesislink`.`project_id` = `project`.`id`;

View File

@ -1 +0,0 @@
DROP TABLE `thesislink`;

View File

@ -1,2 +0,0 @@
ALTER TABLE `general_system_settings` DROP COLUMN `bachelorCountDate`;
ALTER TABLE `general_system_settings` DROP COLUMN `masterCountDate`;

View File

@ -1 +0,0 @@
ALTER TABLE `general_system_settings` ADD COLUMN `showSingleSignOn` BOOLEAN DEFAULT TRUE NOT NULL;

View File

@ -1 +0,0 @@
ALTER TABLE `opposition_report` CHANGE `thesisSummary` `thesisSummary` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;

View File

@ -1,14 +0,0 @@
CREATE TABLE `department_service` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` DATETIME NOT NULL,
`lastModified` DATETIME NOT NULL,
`version` int(11) NOT NULL,
`user_id` bigint(20) NOT NULL,
`dateStarted` DATETIME NOT NULL,
`dateEnded` DATETIME NOT NULL,
`hours` INT NOT NULL,
`description` LONGTEXT DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `department_service_user` (`user_id`),
CONSTRAINT `department_service_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,5 +0,0 @@
ALTER TABLE `user_settings`
DROP `apiKey`,
DROP `available`,
DROP `iPhoneId`,
DROP `statusMessage`;

View File

@ -1,17 +0,0 @@
CREATE TABLE IF NOT EXISTS `transaction` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL,
`project_id` bigint(20) NOT NULL,
`user_id` bigint(20) NOT NULL,
`amount` int(11) NOT NULL,
`comment` longtext,
PRIMARY KEY (`id`),
KEY `FK_transaction_project` (`project_id`),
KEY `FK_transaction_user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
ALTER TABLE `transaction`
ADD CONSTRAINT `FK_transaction_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
ADD CONSTRAINT `FK_transaction_project` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`);

View File

@ -1,3 +0,0 @@
ALTER TABLE `project` ADD `draft_id` bigint(20) DEFAULT NULL;
ALTER TABLE `project` ADD KEY `FK_draft` (`draft_id`);
ALTER TABLE `project` ADD CONSTRAINT `FK_draft` FOREIGN KEY (`draft_id`) REFERENCES `file_description` (`id`);

View File

@ -1,32 +0,0 @@
CREATE TABLE `Decision` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`reason` varchar(255) DEFAULT NULL,
`status` varchar(255) DEFAULT NULL,
`attachment_id` bigint(20) DEFAULT NULL,
`thesis_id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_d3pbhn9dtb5oqmjhpgk5cs4t1` (`attachment_id`),
KEY `FK_s9cnrqblgomd6mhoaet3lgg1b` (`thesis_id`),
CONSTRAINT `FK_s9cnrqblgomd6mhoaet3lgg1b` FOREIGN KEY (`thesis_id`) REFERENCES `file_description` (`id`),
CONSTRAINT `FK_d3pbhn9dtb5oqmjhpgk5cs4t1` FOREIGN KEY (`attachment_id`) REFERENCES `file_description` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `FinalSeminarApproval` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`project_id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_9lr1dn8boyfc5a0477ld4q8rw` (`project_id`),
CONSTRAINT `FK_9lr1dn8boyfc5a0477ld4q8rw` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `FinalSeminarApproval_Decision` (
`FinalSeminarApproval_id` bigint(20) NOT NULL,
`decisions_id` bigint(20) NOT NULL,
`decisions_ORDER` int(11) NOT NULL,
PRIMARY KEY (`FinalSeminarApproval_id`,`decisions_ORDER`),
UNIQUE KEY `UK_r1ba76xigvossvqj1vrkxy2cc` (`decisions_id`),
KEY `FK_r1ba76xigvossvqj1vrkxy2cc` (`decisions_id`),
KEY `FK_7g4wtjpvw81tv6hna7vwvu05f` (`FinalSeminarApproval_id`),
CONSTRAINT `FK_7g4wtjpvw81tv6hna7vwvu05f` FOREIGN KEY (`FinalSeminarApproval_id`) REFERENCES `FinalSeminarApproval` (`id`),
CONSTRAINT `FK_r1ba76xigvossvqj1vrkxy2cc` FOREIGN KEY (`decisions_id`) REFERENCES `Decision` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,22 +0,0 @@
CREATE TABLE `thread` (
`id` BIGINT(20) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL,
`deleted` tinyint(1) NOT NULL,
`project` bigint(20) NOT NULL,
`subject` varchar(1000) NOT NULL,
KEY `thread_project` (`project`)
) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8;
ALTER TABLE `thread` ADD CONSTRAINT `thread_project` FOREIGN KEY (`project`) REFERENCES `project` (`id`);
CREATE TABLE `reviewer_thread` (
`id` BIGINT(20) NOT NULL PRIMARY KEY AUTO_INCREMENT
) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8;
ALTER TABLE `reviewer_thread` ADD CONSTRAINT `reviewer_thread_thread` FOREIGN KEY (`id`) REFERENCES `thread` (`id`);
INSERT INTO `thread` SELECT `id`, `dateCreated`, `lastModified`, `version`, `deleted`, `project`, `subject` FROM `forum_threads`;
ALTER TABLE `forum_threads` ADD CONSTRAINT `forum_threads_thread` FOREIGN KEY (`id`) REFERENCES `thread` (`id`);

View File

@ -1,9 +0,0 @@
ALTER TABLE `forum_threads` DROP COLUMN `dateCreated`;
ALTER TABLE `forum_threads` DROP COLUMN `lastModified`;
ALTER TABLE `forum_threads` DROP COLUMN `version`;
ALTER TABLE `forum_threads` DROP COLUMN `deleted`;
ALTER TABLE `forum_threads` DROP FOREIGN KEY `FKAF97368B247CE02D`;
ALTER TABLE `forum_threads` DROP COLUMN `project`;
ALTER TABLE `forum_threads` DROP COLUMN `subject`;

View File

@ -1,2 +0,0 @@
ALTER TABLE `forum_posts` DROP FOREIGN KEY `FKEDDC4F355E9380A1`;
ALTER TABLE `forum_posts` ADD CONSTRAINT `forum_posts_thread` FOREIGN KEY (`thread`) REFERENCES `thread` (`id`);

View File

@ -1,19 +0,0 @@
CREATE TABLE `RoughDraftApproval` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`project_id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `rough_draft_approval_project` (`project_id`),
CONSTRAINT `rough_draft_approval_project` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `RoughDraftApproval_Decision` (
`RoughDraftApproval_id` bigint(20) NOT NULL,
`decisions_id` bigint(20) NOT NULL,
`decisions_ORDER` int(11) NOT NULL,
PRIMARY KEY (`RoughDraftApproval_id`,`decisions_ORDER`),
UNIQUE KEY `rough_draft_approval_uk` (`decisions_id`),
KEY `rough_draft_approval_decision_decisions` (`decisions_id`),
KEY `rough_draft_approval_decision_rough_draft` (`RoughDraftApproval_id`),
CONSTRAINT `rough_draft_approval_decision_rough_draft` FOREIGN KEY (`RoughDraftApproval_id`) REFERENCES `RoughDraftApproval` (`id`),
CONSTRAINT `rough_draft_approval_decision_decisions` FOREIGN KEY (`decisions_id`) REFERENCES `Decision` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,11 +0,0 @@
DROP TABLE `RoughDraftApproval_Decision`;
DROP TABLE `RoughDraftApproval`;
RENAME TABLE `FinalSeminarApproval` TO `ReviewerApproval`;
RENAME TABLE `FinalSeminarApproval_Decision` TO `ReviewerApproval_Decision`;
ALTER TABLE `ReviewerApproval_Decision` DROP FOREIGN KEY `FK_7g4wtjpvw81tv6hna7vwvu05f`;
ALTER TABLE `ReviewerApproval_Decision` CHANGE COLUMN `FinalSeminarApproval_id` `ReviewerApproval_id` bigint(20) not null;
ALTER TABLE `ReviewerApproval_Decision` ADD CONSTRAINT `FK_7g4wtjpvw81tv6hna7vwvu05f` FOREIGN KEY (`ReviewerApproval_id`) REFERENCES `ReviewerApproval` (`id`);
ALTER TABLE `ReviewerApproval` ADD COLUMN `type` varchar(64) not null;

View File

@ -1 +0,0 @@
ALTER TABLE `AnnualReview` DROP COLUMN `year`;

View File

@ -1,2 +0,0 @@
ALTER TABLE `project` DROP FOREIGN KEY `FK_draft`;
ALTER TABLE `project` DROP COLUMN `draft_id`;

View File

@ -1 +0,0 @@
ALTER TABLE `FinalThesis` ADD COLUMN `dateApproved` DATE;

View File

@ -1,5 +0,0 @@
INSERT INTO `Event`
(`name`, `description`)
VALUES
('Step.FINAL_SEMINAR_APPROVAL', 'The thesis is approved for final seminar by the reviewer'),
('Step.ROUGH_DRAFT_APPROVAL', 'Rough draft is approved by the reviewer');

View File

@ -1,7 +0,0 @@
CREATE TABLE `ExternalResource` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`url` VARCHAR(255) NOT NULL,
`label` VARCHAR(255) NOT NULL,
`relevantFor_id` BIGINT(20) NOT NULL,
CONSTRAINT `ExternalResource_ProjectType_relevantFor` FOREIGN KEY (`relevantFor_id`) REFERENCES `ProjectType` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8;

View File

@ -1 +0,0 @@
ALTER TABLE `notification_delivery_configuration` MODIFY COLUMN `event` VARCHAR(255) NOT NULL;

View File

@ -1,11 +0,0 @@
-- Clean up
ALTER TABLE `username` DROP KEY `username`;
ALTER TABLE `username` DROP KEY `UK_s525no5d53h1qncd9n3vp3nfw`;
ALTER TABLE `username` DROP KEY `FKF02988D6895349BF`;
-- What the script should be doing
-- We skip usernames that already have a @ in them since they are most likely correct already
UPDATE `username` SET `username` = LOWER(CONCAT(`username`, '@', `realm`)) WHERE `username` NOT LIKE '%@%';
ALTER TABLE `username` DROP COLUMN `realm`;
ALTER TABLE `username` ADD UNIQUE KEY `username_must_be_unique` (`username`);

View File

@ -1 +0,0 @@
ALTER TABLE `FinalSeminarSettings` ADD COLUMN `evaluationURL` LONGTEXT DEFAULT NULL;

View File

@ -1,10 +0,0 @@
CREATE TABLE IF NOT EXISTS `footer_link` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL,
`footerColumn` varchar(10) NOT NULL,
`title` varchar(255) NOT NULL,
`URL` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;

View File

@ -1 +0,0 @@
ALTER TABLE `Decision` MODIFY COLUMN `reason` LONGTEXT DEFAULT NULL;

View File

@ -1,10 +0,0 @@
CREATE TABLE IF NOT EXISTS `reviewer_deadline_settings` (
`id` bigint(20) NOT NULL,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL,
`roughDraftApproval` int(11) NOT NULL,
`finalSeminarApproval` int(11) NOT NULL,
`finalGrading` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,8 +0,0 @@
ALTER TABLE `ReviewerApproval` ADD (
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL
);
UPDATE `ReviewerApproval` SET `dateCreated` = NOW();
UPDATE `ReviewerApproval` SET `lastModified` = NOW();

View File

@ -1 +0,0 @@
ALTER TABLE `FinalThesis` ADD COLUMN `dateRejected` DATE;

View File

@ -1,9 +0,0 @@
CREATE TABLE IF NOT EXISTS `footer_address` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`address` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;

View File

@ -1,5 +0,0 @@
ALTER TABLE `Decision` ADD COLUMN `requested` DATETIME NOT NULL;
ALTER TABLE `Decision` ADD COLUMN `decisionDate` DATETIME DEFAULT NULL;
UPDATE `Decision` SET `requested` = (SELECT `dateCreated` FROM `file_description` WHERE `id` = `thesis_id`);
UPDATE `Decision` SET `decisionDate` = `requested` WHERE `status` != 'UNDECIDED';

View File

@ -1 +0,0 @@
UPDATE `user_role` SET `role` = 'SUPERVISOR' WHERE `role` like 'EMPLOYEE';

View File

@ -1 +0,0 @@
UPDATE `user_role` SET `role` = 'AUTHOR' WHERE `role` like 'STUDENT';

View File

@ -1 +0,0 @@
ALTER TABLE `FinalSeminarSettings` ADD COLUMN `oppositionPriorityDays` INT NOT NULL;

View File

@ -1,4 +0,0 @@
INSERT INTO `Language` (`dateCreated`, `lastModified`, `version`, `name`)
SELECT NOW(), NOW(), 0, 'Swedish' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `Language` WHERE `name` = 'Swedish');
INSERT INTO `Language` (`dateCreated`, `lastModified`, `version`, `name`)
SELECT NOW(), NOW(), 0, 'English' FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `Language` WHERE `name` = 'English');

View File

@ -1,9 +0,0 @@
ALTER TABLE `final_seminar` ADD COLUMN `reportLanguage_id` BIGINT(20) NOT NULL;
UPDATE `final_seminar` SET `reportLanguage_id` = (SELECT `id` FROM `Language` WHERE UPPER(`name`) = UPPER(`final_seminar`.`reportLanguage`));
ALTER TABLE `final_seminar` ADD CONSTRAINT `FK_final_seminar_report_language` FOREIGN KEY (`reportLanguage_id`) REFERENCES `Language` (`id`);
ALTER TABLE `final_seminar` DROP COLUMN `reportLanguage`;
ALTER TABLE `final_seminar` ADD COLUMN `presentationLanguage_id` BIGINT(20) NOT NULL;
UPDATE `final_seminar` SET `presentationLanguage_id` = (SELECT `id` FROM `Language` WHERE UPPER(`name`) = UPPER(`final_seminar`.`presentationLanguage`));
ALTER TABLE `final_seminar` ADD CONSTRAINT `FK_final_seminar_presentation_language` FOREIGN KEY (`presentationLanguage_id`) REFERENCES `Language` (`id`);
ALTER TABLE `final_seminar` DROP COLUMN `presentationLanguage`;

View File

@ -1,4 +0,0 @@
ALTER TABLE `idea` ADD COLUMN `language_id` BIGINT(20) DEFAULT NULL;
UPDATE `idea` SET `language_id` = (SELECT `id` FROM `Language` WHERE UPPER(`name`) = UPPER(`idea`.`language`));
ALTER TABLE `idea` ADD CONSTRAINT `FK_idea_language` FOREIGN KEY (`language_id`) REFERENCES `Language` (`id`);
ALTER TABLE `idea` DROP COLUMN `language`;

View File

@ -1,4 +0,0 @@
ALTER TABLE `user_languages` ADD COLUMN `language_id` BIGINT(20) NOT NULL;
UPDATE `user_languages` SET `language_id` = (SELECT `id` FROM `Language` WHERE UPPER(`name`) = UPPER(`user_languages`.`languages`));
ALTER TABLE `user_languages` ADD CONSTRAINT `FK_user_languages_language` FOREIGN KEY (`language_id`) REFERENCES `Language` (`id`);
ALTER TABLE `user_languages` DROP COLUMN `languages`;

View File

@ -1,21 +0,0 @@
CREATE TABLE IF NOT EXISTS `group` (
`id` bigint(20) NOT NULL,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL,
`title` varchar(250) NOT NULL,
`description` LONGTEXT,
`user_id` bigint(20) NOT NULL,
`active` bit(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `group_project` (
`group_id` bigint(20) NOT NULL,
`project_id` bigint(20) NOT NULL,
PRIMARY KEY (`group_id`, `project_id`),
KEY `FK_group_id` (`group_id`),
KEY `FK_project_id` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1,28 +0,0 @@
DROP TABLE `group`, `group_project`;
CREATE TABLE IF NOT EXISTS `project_group` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`description` LONGTEXT,
`user_id` bigint(20) NOT NULL,
`active` bit(1) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
ALTER TABLE `project_group` ADD CONSTRAINT `FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
CREATE TABLE IF NOT EXISTS `project_group_project` (
`project_group_id` bigint(20) NOT NULL,
`project_id` bigint(20) NOT NULL,
PRIMARY KEY (`project_group_id`, `project_id`),
KEY `FK_project_group_id` (`project_group_id`),
KEY `FK_project_id` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `project_group_project`
ADD CONSTRAINT `FK_project_group_id` FOREIGN KEY (`project_group_id`) REFERENCES `project_group` (`id`),
ADD CONSTRAINT `FK_project_id` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`);

View File

@ -1 +0,0 @@
ALTER TABLE `general_system_settings` DROP `remoteExport` ;

View File

@ -1,52 +0,0 @@
CREATE TABLE IF NOT EXISTS `group_thread` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL,
`deleted` tinyint(1) NOT NULL,
`subject` varchar(255) NOT NULL,
`user` bigint(20) NOT NULL,
`project_group` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY (`deleted`),
KEY (`user`),
KEY (`project_group`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
ALTER TABLE `group_thread`
ADD CONSTRAINT FOREIGN KEY (`user`) REFERENCES `user` (`id`),
ADD CONSTRAINT FOREIGN KEY (`project_group`) REFERENCES `project_group` (`id`);
CREATE TABLE IF NOT EXISTS `group_post` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL,
`deleted` tinyint(1) NOT NULL,
`content` LONGTEXT NOT NULL,
`user` bigint(20) NOT NULL,
`group_thread` bigint(20) NOT NULL,
`attachment` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY (`deleted`),
KEY (`user`),
KEY (`group_thread`),
KEY (`attachment`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
ALTER TABLE `group_post`
ADD CONSTRAINT FOREIGN KEY (`user`) REFERENCES `user` (`id`),
ADD CONSTRAINT FOREIGN KEY (`group_thread`) REFERENCES `group_thread` (`id`),
ADD CONSTRAINT FOREIGN KEY (`attachment`) REFERENCES `file_description` (`id`);
CREATE TABLE IF NOT EXISTS `group_thread_group_post` (
`group_thread` bigint(20) NOT NULL,
`group_post` bigint(20) NOT NULL,
PRIMARY KEY (`group_thread`, `group_post`),
KEY (`group_thread`),
KEY (`group_post`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `group_thread_group_post`
ADD CONSTRAINT FOREIGN KEY (`group_thread`) REFERENCES `group_thread` (`id`),
ADD CONSTRAINT FOREIGN KEY (`group_post`) REFERENCES `group_post` (`id`);

View File

@ -1,5 +0,0 @@
CREATE TABLE `daisy_grading_report_export` (
gradingReport_id BIGINT(20) NOT NULL,
PRIMARY KEY (`gradingReport_id`),
CONSTRAINT `grading_report_export_grading_report` FOREIGN KEY (`gradingReport_id`) REFERENCES `grading_report` (`id`)
) ENGINE =InnoDB DEFAULT CHARSET =latin1;

Some files were not shown because too many files have changed in this diff Show More