Added some SQL-updates needed before deployment.

Extreme caution must be used when deploying this since tables have to
be dropped, re-created and repopulated.
This commit is contained in:
Robin Eklund 2011-12-12 11:03:54 +01:00
parent 7f21023701
commit 5f8fa85a00

@ -195,3 +195,80 @@ CREATE TABLE `Student_Exemption` (
CONSTRAINT `FKEB360B20259AA500` FOREIGN KEY (`exemptions_id`) REFERENCES `Exemption` (`id`),
CONSTRAINT `FKEB360B202B6C61BA` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`)
) ENGINE=InnoDB;
DROP TABLE log_entry;
DROP TABLE log;
CREATE TABLE `log` (
`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,
`project_id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `project_id` (`project_id`),
KEY `FK1A344C1813915` (`project_id`),
KEY `deleted_index` (`deleted`),
CONSTRAINT `FK1A344C1813915` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`)
) ENGINE=InnoDB;
CREATE TABLE `log_entry` (
`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,
`contents` longtext,
`creator_id` bigint(20) NOT NULL,
`log_id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK88028BB7E44F4DBE` (`creator_id`),
KEY `FK88028BB7AA87FAB5` (`log_id`),
KEY `deleted_index` (`deleted`),
CONSTRAINT `FK88028BB7AA87FAB5` FOREIGN KEY (`log_id`) REFERENCES `log` (`id`),
CONSTRAINT `FK88028BB7E44F4DBE` FOREIGN KEY (`creator_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB;
--Be careful here, old data must be saved via post-table creation inserts
DROP TABLE checklist_template_checklist_category;
--Be careful here, old data must be saved via post-table creation inserts
DROP TABLE checklist_category;
CREATE TABLE `checklist_category` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateCreated` datetime NOT NULL,
`lastModified` datetime NOT NULL,
`version` int(11) NOT NULL,
`categoryName` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `categoryName` (`categoryName`)
) ENGINE=InnoDB;
CREATE TABLE `checklist_template_checklist_category` (
`checklist_template_id` bigint(20) NOT NULL,
`categories_id` bigint(20) NOT NULL,
`version` int(4) NOT NULL DEFAULT '0',
KEY `FK4E82F44372B51E82` (`checklist_template_id`),
KEY `FK4E82F4438725F1D` (`categories_id`),
CONSTRAINT `FK4E82F44372B51E82` FOREIGN KEY (`checklist_template_id`) REFERENCES `checklist_template` (`id`),
CONSTRAINT `FK4E82F4438725F1D` FOREIGN KEY (`categories_id`) REFERENCES `checklist_category` (`id`)
) ENGINE=InnoDB;
--The following insert statements are examples, must obviously be made with already existing data in mind.
--INSERT checklist_category, exempel:
--INSERT INTO `checklist_category` (`id`,`dateCreated`,`lastModified`,`categoryName`,`version`) VALUES (3,'2011-09-08 00:00:00','2011-09-08 00:00:00','Bachelor',0),(4,'2011-09-08 00:00:00','2011-09-08 00:00:00','Master',0),(5,'2011-10-12 10:25:29','2011-10-12 10:27:26','Supervisor',0),(6,'2011-10-12 00:00:00','2011-10-12 00:00:00','Peer',0);
--INSERT checklist_template_checklist_category, exempel:
--INSERT INTO `checklist_template_checklist_category` VALUES (20,4,0),(20,3,0),(21,6,0),(17,4,0),(17,3,0),(21,5,0),(18,6,0),(18,5,0),(22,4,0),(22,3,0),(23,4,0),(23,3,0),(24,6,0),(25,4,0),(25,3,0),(26,6,0),(26,5,0),(27,4,0),(27,3,0),(28,6,0),(28,5,0),(29,4,0),(29,3,0),(24,5,0),(26,4,0),(26,3,0),(28,4,0),(28,3,0);
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;