-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from diggyk/fates_refactor
Fates refactor
- Loading branch information
Showing
18 changed files
with
346 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
TRUNCATE TABLE `fates`; | ||
ALTER TABLE `fates` DROP FOREIGN KEY `fates_ibfk_2`; | ||
ALTER TABLE `fates` DROP `completion_type_id`; | ||
|
||
INSERT INTO fates | ||
VALUES | ||
(1,1,NULL, 0, 1, 'Reboot or release the system.'); | ||
|
||
INSERT INTO fates | ||
VALUES | ||
(2,2,1, 0, 1, 'A reboot finishes labors.'); | ||
|
||
INSERT INTO fates | ||
VALUES | ||
(3,3,NULL, 0, 1, 'Release or acknowledge downtime'); | ||
|
||
INSERT INTO fates | ||
VALUES | ||
(4,4,3, 0, 1, 'Perform maintenance'); | ||
|
||
INSERT INTO fates | ||
VALUES | ||
(5,5,4, 1, 0, 'Maintenance completed'); | ||
|
||
ALTER TABLE `labors` ADD `fate_id` INT(11) NOT NULL DEFAULT 0 AFTER `starting_labor_id`; | ||
|
||
UPDATE `labors` SET `fate_id`=1; | ||
ALTER TABLE `labors` ADD FOREIGN KEY `ix_labors_fate_id` (`fate_id`) REFERENCES FATES(`id`); | ||
|
||
|
||
update `labors` l SET `fate_id`=( | ||
select f.id from `events` e, `event_types` et, `fates` f where l.creation_event_id = e.id and e.event_type_id = et.id and f.creation_type_id = et.id | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.