scipro/resources/db_update_scripts/update_db_2012-02-15.sql
Jona Ekenberg 2fcd079183 hej
2013-01-18 19:55:18 +01:00

51 lines
2.6 KiB
SQL
Executable File

-- required database changes for the property projectIdea#applicationPeriod
ALTER TABLE projectIdea ADD COLUMN applicationPeriod_id bigint(20) NOT NULL,
ADD CONSTRAINT `FKC7F5C9B0BEC322C1` FOREIGN KEY (`applicationPeriod_id`) REFERENCES `ApplicationPeriod` (`id`);
-- required database changes for new keyword imports.
ALTER TABLE Keyword ADD COLUMN identifier bigint(20);
-- BELOW IS ONLY FOR PROD DB, DON'T USE LOCALLY IF YOU DON'T HAVE THE SAME KEYWORD IDs
UPDATE Keyword SET identifier = 17 WHERE Keyword.id = 181;
UPDATE Keyword SET identifier = 14 WHERE Keyword.id = 179;
UPDATE Keyword SET identifier = 28 WHERE Keyword.id = 180;
UPDATE Keyword SET identifier = 565 WHERE Keyword.id = 16;
UPDATE Keyword SET identifier = 564 WHERE Keyword.id = 15;
UPDATE Keyword SET identifier = 566 WHERE Keyword.id = 14;
UPDATE Keyword SET identifier = 499 WHERE Keyword.id = 6;
UPDATE Keyword SET identifier = 268 WHERE Keyword.id = 5;
UPDATE Keyword SET identifier = 295 WHERE Keyword.id = 10;
UPDATE Keyword SET identifier = 15 WHERE Keyword.id = 12;
UPDATE Keyword SET identifier = 209 WHERE Keyword.id = 9;
UPDATE Keyword SET identifier = 567 WHERE Keyword.id = 13;
UPDATE Keyword SET identifier = 16 WHERE Keyword.id = 17;
-- the hibernate generated SQL :
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,
`applicationPeriod_id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `FKC7F5C9B0C1813915` (`project_id`),
KEY `FKC7F5C9B048F01CA1` (`match_id`),
KEY `FKC7F5C9B0B2B6081F` (`projectClass_id`),
KEY `FKC7F5C9B0225C6E84` (`preferredSupervisor_id`),
KEY `FKC7F5C9B0BEC322C1` (`applicationPeriod_id`),
CONSTRAINT `FKC7F5C9B0BEC322C1` FOREIGN KEY (`applicationPeriod_id`) REFERENCES `ApplicationPeriod` (`id`),
CONSTRAINT `FKC7F5C9B0225C6E84` FOREIGN KEY (`preferredSupervisor_id`) REFERENCES `role` (`id`),
CONSTRAINT `FKC7F5C9B048F01CA1` FOREIGN KEY (`match_id`) REFERENCES `matchings` (`id`),
CONSTRAINT `FKC7F5C9B0B2B6081F` FOREIGN KEY (`projectClass_id`) REFERENCES `project_class` (`id`),
CONSTRAINT `FKC7F5C9B0C1813915` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;