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

36 lines
1.7 KiB
SQL
Executable File

-- required database changes for the property Match#rejectedBy
ALTER TABLE matchings ADD COLUMN rejectedBy_id bigint(20);
ALTER TABLE matchings ADD CONSTRAINT `FK24A2D416D0C9D7F5` FOREIGN KEY (`rejectedBy_id`) REFERENCES `user` (`id`);
/* The results running the queries above should look exactly like the hibernate generated table below, this can be tested by
running "show create table matchings;" from the command prompt
CREATE TABLE IF NOT EXISTS `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,
`rejectedBy_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK24A2D4169AA5FCB` (`createdBy_id`),
KEY `FK24A2D4164E31D7A1` (`projectIdea_id`),
KEY `FK24A2D416BCA56165` (`supervisor_id`),
KEY `FK24A2D416D0C9D7F5` (`rejectedBy_id`),
CONSTRAINT `FK24A2D416D0C9D7F5` FOREIGN KEY (`rejectedBy_id`) REFERENCES `user` (`id`),
CONSTRAINT `FK24A2D4164E31D7A1` FOREIGN KEY (`projectIdea_id`) REFERENCES `projectIdea` (`id`),
CONSTRAINT `FK24A2D4169AA5FCB` FOREIGN KEY (`createdBy_id`) REFERENCES `user` (`id`),
CONSTRAINT `FK24A2D416BCA56165` FOREIGN KEY (`supervisor_id`) REFERENCES `role` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=latin1 |
*/
-- no database changes were required for changing the annotation of ProjectIdea#match from @ManyToOne to @OneToOne