Created
April 12, 2017 10:23
-
-
Save psyao/f1b027d252bedc81b26c68a2e9219029 to your computer and use it in GitHub Desktop.
Clean WP database after install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Constraints for table `wp_commentmeta` | |
-- | |
ALTER TABLE `wp_commentmeta` | |
ADD CONSTRAINT `comment_id` FOREIGN KEY (`comment_id`) REFERENCES `wp_comments` (`comment_ID`) ON DELETE CASCADE ON UPDATE CASCADE; | |
-- | |
-- Constraints for table `wp_comments` | |
-- | |
ALTER TABLE `wp_comments` | |
ADD CONSTRAINT `commet_post_id` FOREIGN KEY (`comment_post_ID`) REFERENCES `wp_posts` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE; | |
-- | |
-- Constraints for table `wp_postmeta` | |
-- | |
ALTER TABLE `wp_postmeta` | |
ADD CONSTRAINT `post_id` FOREIGN KEY (`post_id`) REFERENCES `wp_posts` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE; | |
-- | |
-- Constraints for table `wp_posts` | |
-- | |
ALTER TABLE `wp_posts` | |
ADD CONSTRAINT `author_id` FOREIGN KEY (`post_author`) REFERENCES `wp_users` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE; | |
-- | |
-- Constraints for table `wp_term_relationships` | |
-- | |
ALTER TABLE `wp_term_relationships` | |
ADD CONSTRAINT `term_taxonomy_id` FOREIGN KEY (`term_taxonomy_id`) REFERENCES `wp_term_taxonomy` (`term_taxonomy_id`) ON DELETE CASCADE ON UPDATE CASCADE; | |
-- | |
-- Constraints for table `wp_term_taxonomy` | |
-- | |
ALTER TABLE `wp_term_taxonomy` | |
ADD CONSTRAINT `term_id` FOREIGN KEY (`term_id`) REFERENCES `wp_terms` (`term_id`) ON DELETE CASCADE ON UPDATE CASCADE; | |
-- | |
-- Constraints for table `wp_termmeta` | |
-- | |
ALTER TABLE `wp_termmeta` | |
ADD CONSTRAINT `termmeta_term_id` FOREIGN KEY (`term_id`) REFERENCES `wp_terms` (`term_id`) ON DELETE CASCADE ON UPDATE CASCADE; | |
-- | |
-- Constraints for table `wp_usermeta` | |
-- | |
ALTER TABLE `wp_usermeta` | |
ADD CONSTRAINT `user_id` FOREIGN KEY (`user_id`) REFERENCES `wp_users` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE; | |
-- | |
-- Delete posts | |
-- | |
DELETE FROM `wp_posts`; | |
-- | |
-- Reset auto increment | |
-- | |
ALTER TABLE `wp_posts` AUTO_INCREMENT = 1; | |
ALTER TABLE `wp_postmeta` AUTO_INCREMENT = 1; | |
ALTER TABLE `wp_comments` AUTO_INCREMENT = 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment