From ac756e88583e21c60b56b52b34957f1908f9167f Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Tue, 09 Mar 2010 01:57:39 -0500 Subject: [PATCH] - fix add index --- SQL/mysql.update.sql | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/SQL/mysql.update.sql b/SQL/mysql.update.sql index 17301ab..c4a8979 100644 --- a/SQL/mysql.update.sql +++ b/SQL/mysql.update.sql @@ -57,3 +57,30 @@ 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`); +ALTER TABLE `cache` ADD CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`) + REFERENCES `users`(`user_id`); +ALTER TABLE `contacts` ADD CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`) + REFERENCES `users`(`user_id`); +ALTER TABLE `identities` ADD CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`) + REFERENCES `users`(`user_id`); + +ALTER TABLE `contacts` ALTER `name` SET DEFAULT ''; +ALTER TABLE `contacts` ALTER `firstname` SET DEFAULT ''; +ALTER TABLE `contacts` ALTER `surname` SET DEFAULT ''; + +ALTER TABLE `identities` ADD INDEX `user_identities_index` (`user_id`, `del`); + +/*!40014 SET FOREIGN_KEY_CHECKS=1 */; -- Gitblit v1.9.1