-- phpMyAdmin SQL Dump
-- version 2.11.2.1
-- http://www.phpmyadmin.net
--
-- Generation Time: May 04, 2008 at 05:47 AM
-- Server version: 5.0.24
-- PHP Version: 4.4.7

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `dc2`
--

-- --------------------------------------------------------

--
-- Constraints for dumped tables
--

--
-- Constraints for table `dc_category`
--
ALTER TABLE `dc_category`
  ADD CONSTRAINT `dc_fk_category_blog` FOREIGN KEY (`blog_id`) REFERENCES `dc_blog` (`blog_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dc_comment`
--
ALTER TABLE `dc_comment`
  ADD CONSTRAINT `dc_fk_comment_post` FOREIGN KEY (`post_id`) REFERENCES `dc_post` (`post_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dc_link`
--
ALTER TABLE `dc_link`
  ADD CONSTRAINT `dc_fk_link_blog` FOREIGN KEY (`blog_id`) REFERENCES `dc_blog` (`blog_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dc_media`
--
ALTER TABLE `dc_media`
  ADD CONSTRAINT `dc_fk_media_user` FOREIGN KEY (`user_id`) REFERENCES `dc_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dc_meta`
--
ALTER TABLE `dc_meta`
  ADD CONSTRAINT `dc_fk_meta_post` FOREIGN KEY (`post_id`) REFERENCES `dc_post` (`post_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dc_permissions`
--
ALTER TABLE `dc_permissions`
  ADD CONSTRAINT `dc_fk_permissions_blog` FOREIGN KEY (`blog_id`) REFERENCES `dc_blog` (`blog_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dc_fk_permissions_user` FOREIGN KEY (`user_id`) REFERENCES `dc_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dc_ping`
--
ALTER TABLE `dc_ping`
  ADD CONSTRAINT `dc_fk_ping_post` FOREIGN KEY (`post_id`) REFERENCES `dc_post` (`post_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dc_post`
--
ALTER TABLE `dc_post`
  ADD CONSTRAINT `dc_fk_post_blog` FOREIGN KEY (`blog_id`) REFERENCES `dc_blog` (`blog_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dc_fk_post_category` FOREIGN KEY (`cat_id`) REFERENCES `dc_category` (`cat_id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `dc_fk_post_user` FOREIGN KEY (`user_id`) REFERENCES `dc_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dc_post_media`
--
ALTER TABLE `dc_post_media`
  ADD CONSTRAINT `dc_fk_media` FOREIGN KEY (`media_id`) REFERENCES `dc_media` (`media_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dc_fk_media_post` FOREIGN KEY (`post_id`) REFERENCES `dc_post` (`post_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dc_setting`
--
ALTER TABLE `dc_setting`
  ADD CONSTRAINT `dc_fk_setting_blog` FOREIGN KEY (`blog_id`) REFERENCES `dc_blog` (`blog_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dc_spamrule`
--
ALTER TABLE `dc_spamrule`
  ADD CONSTRAINT `dc_fk_spamrule_blog` FOREIGN KEY (`blog_id`) REFERENCES `dc_blog` (`blog_id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `dc_user`
--
ALTER TABLE `dc_user`
  ADD CONSTRAINT `dc_fk_user_default_blog` FOREIGN KEY (`user_default_blog`) REFERENCES `dc_blog` (`blog_id`) ON DELETE SET NULL ON UPDATE CASCADE;
