-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy path28_more_fks.sql
14 lines (10 loc) · 1.49 KB
/
28_more_fks.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
ALTER TABLE `user_profiles` ADD CONSTRAINT `FK_user_profiles_users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;
ALTER TABLE `acquaintances` ADD CONSTRAINT `FK_acquaintances_acq_users` FOREIGN KEY (`acq_user_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;
ALTER TABLE `pm_inbox` ADD CONSTRAINT `FK_pm_inbox_to_id` FOREIGN KEY (`to_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;
ALTER TABLE `pm_inbox` ADD CONSTRAINT `FK_pm_inbox_from_id` FOREIGN KEY (`from_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;
ALTER TABLE `pm_inbox` ADD CONSTRAINT `FK_pm_inbox_message_id` FOREIGN KEY (`message_id`) REFERENCES `pm_content` (`message_id`) ON UPDATE NO ACTION ON DELETE NO ACTION;
ALTER TABLE `pm_outbox` ADD CONSTRAINT `FK_pm_outbox_to_id` FOREIGN KEY (`to_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;
ALTER TABLE `pm_outbox` ADD CONSTRAINT `FK_pm_outbox_from_id` FOREIGN KEY (`from_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION;
ALTER TABLE `pm_outbox` ADD CONSTRAINT `FK_pm_outbox_message_id` FOREIGN KEY (`message_id`) REFERENCES `pm_content` (`message_id`) ON UPDATE NO ACTION ON DELETE NO ACTION;
ALTER TABLE `threads` CHANGE `category` `category` INT( 2 ) NULL DEFAULT '0';
ALTER TABLE `threads` ADD CONSTRAINT `FK_threads_category` FOREIGN KEY (`category`) REFERENCES `categories` (`category_id`) ON UPDATE NO ACTION ON DELETE NO ACTION;