Browse Source

Converting issue_update_field to InnoDB, adding foreign key constraint.

Alan Hardman 4 years ago
parent
commit
1654e2469c
2 changed files with 14 additions and 3 deletions
  1. 10 0
      db/15.04.07.sql
  2. 4 3
      db/database.sql

+ 10 - 0
db/15.04.07.sql

@@ -0,0 +1,10 @@
+DELETE FROM `issue_update_field`
+WHERE `issue_update_id` NOT IN (
+	SELECT `id` FROM `issue_update`
+);
+
+ALTER TABLE `issue_update_field`
+ADD CONSTRAINT `issue_update_field_update` FOREIGN KEY (`issue_update_id`) REFERENCES `issue_update`(`id`) ON UPDATE CASCADE ON DELETE CASCADE,
+ENGINE=INNODB;
+
+UPDATE `config` SET `value` = '15.04.07' WHERE `attribute` = 'version';

+ 4 - 3
db/database.sql

@@ -165,8 +165,9 @@ CREATE TABLE `issue_update_field` (
 	`old_value` text NOT NULL,
 	`new_value` text NOT NULL,
 	PRIMARY KEY (`id`),
-	KEY `issue_update_field_update_id` (`issue_update_id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+	KEY `issue_update_field_update_id` (`issue_update_id`),
+	CONSTRAINT `issue_update_field_update` FOREIGN KEY (`issue_update_id`) REFERENCES `issue_update` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 DROP TABLE IF EXISTS `issue_watcher`;
 CREATE TABLE `issue_watcher` (
@@ -276,4 +277,4 @@ CREATE TABLE `config` (
 	UNIQUE KEY `attribute` (`attribute`)
 );
 
-INSERT INTO `config` (`attribute`, `value`) VALUES ('version', '15.03.20');
+INSERT INTO `config` (`attribute`, `value`) VALUES ('version', '15.04.07');