Attempting altering of backend storage via alternative methods

This commit is contained in:
Robin Eklund 2011-12-21 10:35:24 +01:00
parent db8f1d1c68
commit 84bcacebe0

@ -234,34 +234,12 @@ CREATE TABLE `log_entry` (
) 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);
ALTER TABLE checklist_template_checklist_category ENGINE = InnoDB;
ALTER TABLE checklist_category ENGINE = InnoDB;
ALTER TABLE checklist_template_checklist_category ADD KEY `FK4E82F44372B51E82` (`checklist_template_id`);
ALTER TABLE checklist_template_checklist_category ADD KEY `FK4E82F4438725F1D` (`categories_id`);
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` (