221 lines
9.4 KiB
SQL
Executable File
221 lines
9.4 KiB
SQL
Executable File
ALTER TABLE `checklist_template` ADD `templateNumber` INT NOT NULL DEFAULT '999';
|
|
ALTER TABLE `worker_data` ADD `lastSuccessfulRun` DATETIME NULL DEFAULT '2011-11-28 01:00:00' AFTER `lastRun`;
|
|
|
|
ALTER TABLE `project_class_settings` ADD `minAuthors` int(11) NOT NULL DEFAULT '1';
|
|
ALTER TABLE `project_class_settings` ADD `maxAuthors` int(11) NOT NULL DEFAULT '2';
|
|
|
|
CREATE TABLE `ApplicationPeriod` (
|
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
|
`dateCreated` datetime NOT NULL,
|
|
`lastModified` datetime NOT NULL,
|
|
`version` int(11) NOT NULL,
|
|
`endDate` datetime DEFAULT NULL,
|
|
`name` varchar(255) DEFAULT NULL,
|
|
`startDate` datetime DEFAULT NULL,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB;
|
|
|
|
CREATE TABLE `ApplicationPeriod_project_class` (
|
|
`ApplicationPeriod_id` bigint(20) NOT NULL,
|
|
`projectClass_id` bigint(20) NOT NULL,
|
|
PRIMARY KEY (`ApplicationPeriod_id`,`projectClass_id`),
|
|
KEY `FK97FDEC24BEC322C1` (`ApplicationPeriod_id`),
|
|
KEY `FK97FDEC24B2B6081F` (`projectClass_id`),
|
|
CONSTRAINT `FK97FDEC24B2B6081F` FOREIGN KEY (`projectClass_id`) REFERENCES `project_class` (`id`),
|
|
CONSTRAINT `FK97FDEC24BEC322C1` FOREIGN KEY (`ApplicationPeriod_id`) REFERENCES `ApplicationPeriod` (`id`)
|
|
) ENGINE=InnoDB;
|
|
|
|
CREATE TABLE `Exemption` (
|
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
|
`dateCreated` datetime NOT NULL,
|
|
`lastModified` datetime NOT NULL,
|
|
`version` int(11) NOT NULL,
|
|
`comment` varchar(255) DEFAULT NULL,
|
|
`author_id` bigint(20) NOT NULL,
|
|
`grantedBy_id` bigint(20) NOT NULL,
|
|
`projectClass_id` bigint(20) NOT NULL,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `author_id` (`author_id`,`projectClass_id`),
|
|
KEY `FK47352BA9B2B6081F` (`projectClass_id`),
|
|
KEY `FK47352BA9314EAC85` (`author_id`),
|
|
KEY `FK47352BA9DEC4D3D8` (`grantedBy_id`),
|
|
CONSTRAINT `FK47352BA9DEC4D3D8` FOREIGN KEY (`grantedBy_id`) REFERENCES `user` (`id`),
|
|
CONSTRAINT `FK47352BA9314EAC85` FOREIGN KEY (`author_id`) REFERENCES `role` (`id`),
|
|
CONSTRAINT `FK47352BA9B2B6081F` FOREIGN KEY (`projectClass_id`) REFERENCES `project_class` (`id`)
|
|
) ENGINE=InnoDB;
|
|
|
|
CREATE TABLE `KeywordType` (
|
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
|
`dateCreated` datetime NOT NULL,
|
|
`lastModified` datetime NOT NULL,
|
|
`version` int(11) NOT NULL,
|
|
`name` varchar(255) NOT NULL,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `name` (`name`)
|
|
) ENGINE=InnoDB;
|
|
|
|
CREATE TABLE `Keyword` (
|
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
|
`dateCreated` datetime NOT NULL,
|
|
`lastModified` datetime NOT NULL,
|
|
`version` int(11) NOT NULL,
|
|
`deleted` bit(1) NOT NULL,
|
|
`keyword` varchar(255) DEFAULT NULL,
|
|
`type_id` bigint(20) DEFAULT NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `FK32ADB5C9D59A80CA` (`type_id`),
|
|
KEY `deleted_index` (`deleted`),
|
|
CONSTRAINT `FK32ADB5C9D59A80CA` FOREIGN KEY (`type_id`) REFERENCES `KeywordType` (`id`)
|
|
) ENGINE=InnoDB;
|
|
|
|
CREATE TABLE `Language` (
|
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
|
`dateCreated` datetime NOT NULL,
|
|
`lastModified` datetime NOT NULL,
|
|
`version` int(11) NOT NULL,
|
|
`name` varchar(255) DEFAULT NULL,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB;
|
|
|
|
CREATE TABLE `projectIdea` (
|
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
|
`dateCreated` datetime NOT NULL,
|
|
`lastModified` datetime NOT NULL,
|
|
`version` int(11) NOT NULL,
|
|
`externalSupervisorInfo` varchar(255) DEFAULT NULL,
|
|
`title` varchar(255) DEFAULT NULL,
|
|
`practicalHow` varchar(1024) NOT NULL,
|
|
`theoryHow` varchar(1024) NOT NULL,
|
|
`what` varchar(1024) NOT NULL,
|
|
`why` varchar(1024) NOT NULL,
|
|
`match_id` bigint(20) DEFAULT NULL,
|
|
`preferredSupervisor_id` bigint(20) DEFAULT NULL,
|
|
`project_id` bigint(20) DEFAULT NULL,
|
|
`projectClass_id` bigint(20) NOT NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `FKC7F5C9B0C1813915` (`project_id`),
|
|
KEY `FKC7F5C9B048F01CA1` (`match_id`),
|
|
KEY `FKC7F5C9B0B2B6081F` (`projectClass_id`),
|
|
KEY `FKC7F5C9B0225C6E84` (`preferredSupervisor_id`),
|
|
CONSTRAINT `FKC7F5C9B0225C6E84` FOREIGN KEY (`preferredSupervisor_id`) REFERENCES `role` (`id`),
|
|
CONSTRAINT `FKC7F5C9B0B2B6081F` FOREIGN KEY (`projectClass_id`) REFERENCES `project_class` (`id`),
|
|
CONSTRAINT `FKC7F5C9B0C1813915` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`)
|
|
) ENGINE=InnoDB;
|
|
|
|
CREATE TABLE `matchings` (
|
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
|
`dateCreated` datetime NOT NULL,
|
|
`lastModified` datetime NOT NULL,
|
|
`version` int(11) NOT NULL,
|
|
`commentForAdmin` varchar(1024) DEFAULT NULL,
|
|
`commentForStudent` varchar(1024) DEFAULT NULL,
|
|
`points` int(11) NOT NULL,
|
|
`status` varchar(255) DEFAULT NULL,
|
|
`type` varchar(255) DEFAULT NULL,
|
|
`createdBy_id` bigint(20) NOT NULL,
|
|
`projectIdea_id` bigint(20) NOT NULL,
|
|
`supervisor_id` bigint(20) DEFAULT NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `FK24A2D4169AA5FCB` (`createdBy_id`),
|
|
KEY `FK24A2D4164E31D7A1` (`projectIdea_id`),
|
|
KEY `FK24A2D416BCA56165` (`supervisor_id`),
|
|
CONSTRAINT `FK24A2D416BCA56165` FOREIGN KEY (`supervisor_id`) REFERENCES `role` (`id`),
|
|
CONSTRAINT `FK24A2D4164E31D7A1` FOREIGN KEY (`projectIdea_id`) REFERENCES `projectIdea` (`id`),
|
|
CONSTRAINT `FK24A2D4169AA5FCB` FOREIGN KEY (`createdBy_id`) REFERENCES `user` (`id`)
|
|
) ENGINE=InnoDB;
|
|
|
|
ALTER TABLE projectIdea ADD CONSTRAINT `FKC7F5C9B048F01CA1` FOREIGN KEY (`match_id`) REFERENCES `matchings` (`id`);
|
|
|
|
CREATE TABLE `projectIdea_Keyword` (
|
|
`projectIdea_id` bigint(20) NOT NULL,
|
|
`keywords_id` bigint(20) NOT NULL,
|
|
PRIMARY KEY (`projectIdea_id`,`keywords_id`),
|
|
KEY `FK6C66763A4E31D7A1` (`projectIdea_id`),
|
|
KEY `FK6C66763AAE316F00` (`keywords_id`),
|
|
CONSTRAINT `FK6C66763AAE316F00` FOREIGN KEY (`keywords_id`) REFERENCES `Keyword` (`id`),
|
|
CONSTRAINT `FK6C66763A4E31D7A1` FOREIGN KEY (`projectIdea_id`) REFERENCES `projectIdea` (`id`)
|
|
) ENGINE=InnoDB;
|
|
|
|
CREATE TABLE `projectIdea_Language` (
|
|
`projectIdea_id` bigint(20) NOT NULL,
|
|
`languages_id` bigint(20) NOT NULL,
|
|
PRIMARY KEY (`projectIdea_id`,`languages_id`),
|
|
KEY `FKA10C45274E31D7A1` (`projectIdea_id`),
|
|
KEY `FKA10C452755E687C` (`languages_id`),
|
|
CONSTRAINT `FKA10C452755E687C` FOREIGN KEY (`languages_id`) REFERENCES `Language` (`id`),
|
|
CONSTRAINT `FKA10C45274E31D7A1` FOREIGN KEY (`projectIdea_id`) REFERENCES `projectIdea` (`id`)
|
|
) ENGINE=InnoDB;
|
|
|
|
CREATE TABLE `projectIdea_role` (
|
|
`projectIdea_id` bigint(20) NOT NULL,
|
|
`authors_id` bigint(20) NOT NULL,
|
|
KEY `FK1904FDA54E31D7A1` (`projectIdea_id`),
|
|
KEY `FK1904FDA57FEBE8A8` (`authors_id`),
|
|
CONSTRAINT `FK1904FDA57FEBE8A8` FOREIGN KEY (`authors_id`) REFERENCES `role` (`id`),
|
|
CONSTRAINT `FK1904FDA54E31D7A1` FOREIGN KEY (`projectIdea_id`) REFERENCES `projectIdea` (`id`)
|
|
) ENGINE=InnoDB;
|
|
|
|
CREATE TABLE `Employee_projectLimits` (
|
|
`Employee_id` bigint(20) NOT NULL,
|
|
`projectLimits` int(11) DEFAULT NULL,
|
|
`projectLimits_KEY` bigint(20) NOT NULL,
|
|
PRIMARY KEY (`Employee_id`,`projectLimits_KEY`),
|
|
KEY `FKFFE408E01BF5E55` (`projectLimits_KEY`),
|
|
KEY `FKFFE408E05FCBC05F` (`Employee_id`),
|
|
CONSTRAINT `FKFFE408E05FCBC05F` FOREIGN KEY (`Employee_id`) REFERENCES `role` (`id`),
|
|
CONSTRAINT `FKFFE408E01BF5E55` FOREIGN KEY (`projectLimits_KEY`) REFERENCES `project_class` (`id`)
|
|
) ENGINE=InnoDB;
|
|
|
|
CREATE TABLE `Employee_Keyword` (
|
|
`role_id` bigint(20) NOT NULL,
|
|
`keywords_id` bigint(20) NOT NULL,
|
|
PRIMARY KEY (`role_id`,`keywords_id`),
|
|
KEY `FKB402CDFB7B617197` (`role_id`),
|
|
KEY `FKB402CDFBAE316F00` (`keywords_id`),
|
|
CONSTRAINT `FKB402CDFBAE316F00` FOREIGN KEY (`keywords_id`) REFERENCES `Keyword` (`id`),
|
|
CONSTRAINT `FKB402CDFB7B617197` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`)
|
|
) ENGINE=InnoDB;
|
|
|
|
CREATE TABLE `Employee_Language` (
|
|
`role_id` bigint(20) NOT NULL,
|
|
`languages_id` bigint(20) NOT NULL,
|
|
PRIMARY KEY (`role_id`,`languages_id`),
|
|
KEY `FK603173EA55E687C` (`languages_id`),
|
|
KEY `FK603173EA7B617197` (`role_id`),
|
|
CONSTRAINT `FK603173EA7B617197` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
|
|
CONSTRAINT `FK603173EA55E687C` FOREIGN KEY (`languages_id`) REFERENCES `Language` (`id`)
|
|
) ENGINE=InnoDB;
|
|
|
|
CREATE TABLE `Student_Exemption` (
|
|
`role_id` bigint(20) NOT NULL,
|
|
`exemptions_id` bigint(20) NOT NULL,
|
|
PRIMARY KEY (`role_id`,`exemptions_id`),
|
|
UNIQUE KEY `exemptions_id` (`exemptions_id`),
|
|
KEY `FKEB360B202B6C61BA` (`role_id`),
|
|
KEY `FKEB360B20259AA500` (`exemptions_id`),
|
|
CONSTRAINT `FKEB360B20259AA500` FOREIGN KEY (`exemptions_id`) REFERENCES `Exemption` (`id`),
|
|
CONSTRAINT `FKEB360B202B6C61BA` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`)
|
|
) ENGINE=InnoDB;
|
|
|
|
ALTER TABLE log ENGINE = InnoDB;
|
|
ALTER TABLE log ADD CONSTRAINT `FK1A344C1813915` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`);
|
|
|
|
ALTER TABLE log_entry ENGINE = InnoDB;
|
|
ALTER TABLE log_entry ADD CONSTRAINT `FK88028BB7AA87FAB5` FOREIGN KEY (`log_id`) REFERENCES `log` (`id`);
|
|
ALTER TABLE log_entry ADD CONSTRAINT `FK88028BB7E44F4DBE` FOREIGN KEY (`creator_id`) REFERENCES `user` (`id`);
|
|
|
|
ALTER TABLE checklist_template_checklist_category ENGINE = InnoDB;
|
|
ALTER TABLE checklist_category ENGINE = InnoDB;
|
|
ALTER TABLE checklist_template_checklist_category ADD CONSTRAINT `FK4E82F44372B51E82` FOREIGN KEY (`checklist_template_id`) REFERENCES `checklist_template` (`id`);
|
|
ALTER TABLE checklist_template_checklist_category ADD CONSTRAINT `FK4E82F4438725F1D` FOREIGN KEY (`categories_id`) REFERENCES `checklist_category` (`id`);
|
|
|
|
CREATE TABLE `checklist_checklist_category` (
|
|
`checklist_id` bigint(20) NOT NULL,
|
|
`categories_id` bigint(20) NOT NULL,
|
|
`version` int(4) NOT NULL DEFAULT '0',
|
|
KEY `FK54F86EB08725F1D` (`categories_id`),
|
|
KEY `FK54F86EB01F327355` (`checklist_id`),
|
|
CONSTRAINT `FK54F86EB01F327355` FOREIGN KEY (`checklist_id`) REFERENCES `checklist` (`id`),
|
|
CONSTRAINT `FK54F86EB08725F1D` FOREIGN KEY (`categories_id`) REFERENCES `checklist_category` (`id`)
|
|
) ENGINE=InnoDB;
|