Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

2009103100.sql 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. -- Updates from version 0.3.1
  2. -- WARNING: Make sure that all tables are using InnoDB engine!!!
  3. -- If not, use: ALTER TABLE xxx ENGINE=InnoDB;
  4. /* MySQL bug workaround: http://bugs.mysql.com/bug.php?id=46293 */
  5. /*!40014 SET FOREIGN_KEY_CHECKS=0 */;
  6. ALTER TABLE `messages` DROP FOREIGN KEY `user_id_fk_messages`;
  7. ALTER TABLE `cache` DROP FOREIGN KEY `user_id_fk_cache`;
  8. ALTER TABLE `contacts` DROP FOREIGN KEY `user_id_fk_contacts`;
  9. ALTER TABLE `identities` DROP FOREIGN KEY `user_id_fk_identities`;
  10. ALTER TABLE `messages` ADD CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
  11. REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  12. ALTER TABLE `cache` ADD CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
  13. REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  14. ALTER TABLE `contacts` ADD CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
  15. REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  16. ALTER TABLE `identities` ADD CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`)
  17. REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  18. ALTER TABLE `contacts` ALTER `name` SET DEFAULT '';
  19. ALTER TABLE `contacts` ALTER `firstname` SET DEFAULT '';
  20. ALTER TABLE `contacts` ALTER `surname` SET DEFAULT '';
  21. ALTER TABLE `identities` ADD INDEX `user_identities_index` (`user_id`, `del`);
  22. ALTER TABLE `identities` ADD `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00' AFTER `user_id`;
  23. CREATE TABLE `contactgroups` (
  24. `contactgroup_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  25. `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
  26. `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  27. `del` tinyint(1) NOT NULL DEFAULT '0',
  28. `name` varchar(128) NOT NULL DEFAULT '',
  29. PRIMARY KEY(`contactgroup_id`),
  30. CONSTRAINT `user_id_fk_contactgroups` FOREIGN KEY (`user_id`)
  31. REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  32. INDEX `contactgroups_user_index` (`user_id`,`del`)
  33. ) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
  34. CREATE TABLE `contactgroupmembers` (
  35. `contactgroup_id` int(10) UNSIGNED NOT NULL,
  36. `contact_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
  37. `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
  38. PRIMARY KEY (`contactgroup_id`, `contact_id`),
  39. CONSTRAINT `contactgroup_id_fk_contactgroups` FOREIGN KEY (`contactgroup_id`)
  40. REFERENCES `contactgroups`(`contactgroup_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  41. CONSTRAINT `contact_id_fk_contacts` FOREIGN KEY (`contact_id`)
  42. REFERENCES `contacts`(`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE
  43. ) /*!40000 ENGINE=INNODB */;
  44. /*!40014 SET FOREIGN_KEY_CHECKS=1 */;