summaryrefslogtreecommitdiff
path: root/SQL/mysql.update.sql
diff options
context:
space:
mode:
Diffstat (limited to 'SQL/mysql.update.sql')
-rw-r--r--SQL/mysql.update.sql21
1 files changed, 21 insertions, 0 deletions
diff --git a/SQL/mysql.update.sql b/SQL/mysql.update.sql
index 17301ab05..5ad03d4f6 100644
--- a/SQL/mysql.update.sql
+++ b/SQL/mysql.update.sql
@@ -57,3 +57,24 @@ ALTER TABLE `session`
ALTER TABLE `contacts`
ADD INDEX `user_contacts_index` (`user_id`,`email`);
+
+-- Updates from version 0.3.1
+
+/* MySQL bug workaround: http://bugs.mysql.com/bug.php?id=46293 */
+/*!40014 SET FOREIGN_KEY_CHECKS=0; */
+
+ALTER TABLE `messages` DROP FOREIGN KEY `user_id_fk_messages`;
+ALTER TABLE `cache` DROP FOREIGN KEY `user_id_fk_cache`;
+ALTER TABLE `contacts` DROP FOREIGN KEY `user_id_fk_contacts`;
+ALTER TABLE `identities` DROP FOREIGN KEY `user_id_fk_identities`;
+
+ALTER TABLE `messages` ADD CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
+ REFERENCES `users`(`user_id`) /*!40008 ON DELETE CASCADE ON UPDATE CASCADE */;
+ALTER TABLE `cache` ADD CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
+ REFERENCES `users`(`user_id`) /*!40008 ON DELETE CASCADE ON UPDATE CASCADE */;
+ALTER TABLE `contacts` ADD CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
+ REFERENCES `users`(`user_id`) /*!40008 ON DELETE CASCADE ON UPDATE CASCADE */;
+ALTER TABLE `identities` ADD CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`)
+ REFERENCES `users`(`user_id`) /*!40008 ON DELETE CASCADE ON UPDATE CASCADE */;
+
+/*!40014 SET FOREIGN_KEY_CHECKS=1; */