14.12.30.sql 1.3 KB

12345678910111213141516171819202122232425
  1. # This database update occured after commit f6f4e8de
  2. # This update may take a while to run on large databases!
  3. # Clean potentially messy data that could break the upgrade process
  4. UPDATE issue SET owner_id = NULL WHERE owner_id = 0;
  5. UPDATE issue SET sprint_id = NULL WHERE sprint_id = 0;
  6. # Adding foreign key constraints to issue metadata
  7. ALTER TABLE `issue`
  8. CHANGE `status` `status` INT(10) UNSIGNED DEFAULT 1 NOT NULL;
  9. ALTER TABLE `issue`
  10. ADD INDEX `status` (`status`);
  11. ALTER TABLE `issue`
  12. ADD CONSTRAINT `issue_type_id` FOREIGN KEY (`type_id`) REFERENCES `issue_type`(`id`) ON UPDATE CASCADE ON DELETE RESTRICT,
  13. ADD CONSTRAINT `issue_sprint_id` FOREIGN KEY (`sprint_id`) REFERENCES `sprint`(`id`) ON UPDATE CASCADE ON DELETE SET NULL,
  14. ADD CONSTRAINT `issue_owner_id` FOREIGN KEY (`owner_id`) REFERENCES `user`(`id`) ON UPDATE CASCADE ON DELETE SET NULL,
  15. ADD CONSTRAINT `issue_status` FOREIGN KEY (`status`) REFERENCES `issue_status`(`id`) ON UPDATE CASCADE ON DELETE RESTRICT;
  16. # Prevent deleting users with live comments
  17. ALTER TABLE `issue_comment` DROP FOREIGN KEY `comment_user`;
  18. ALTER TABLE `issue_comment` ADD CONSTRAINT `comment_user` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE CASCADE ON DELETE RESTRICT;
  19. # Update Version
  20. UPDATE `config` SET `value` = '14.12.30' WHERE `attribute` = 'version';