{"id":226,"date":"2014-02-12T22:10:38","date_gmt":"2014-02-13T04:10:38","guid":{"rendered":"http:\/\/www.evermoretechnologies.com\/blog\/?p=226"},"modified":"2014-02-12T22:10:38","modified_gmt":"2014-02-13T04:10:38","slug":"deleting-all-products-from-a-magento-database-with-sql","status":"publish","type":"post","link":"https:\/\/www.evermoretechnologies.com\/blog\/2014\/02\/deleting-all-products-from-a-magento-database-with-sql\/","title":{"rendered":"Deleting All Products from a magento database with SQL"},"content":{"rendered":"<p>It doesn&#8217;t happen often, but sometimes I need to wipe all products from a magento database during development. Either an import was written slightly off, or it was just full of test data and it&#8217;s cleaner to wipe the products instead of deleting them through the admin.<\/p>\n<p>A simple script for this found in a few spots on the internet, but the most updated one for Magento 1.8.0.1 is:<\/p>\n<p>[code language=&#8221;sql&#8221;]<br \/>\nSET FOREIGN_KEY_CHECKS = 0;<\/p>\n<p>TRUNCATE TABLE `catalog_product_bundle_price_index`;<br \/>\nTRUNCATE TABLE `catalog_product_bundle_selection`;<br \/>\nTRUNCATE TABLE `catalog_product_bundle_selection_price`;<br \/>\nTRUNCATE TABLE `catalog_product_bundle_option_value`;<br \/>\nTRUNCATE TABLE `catalog_product_bundle_option`;<br \/>\nTRUNCATE TABLE `catalog_product_entity_datetime`;<br \/>\nTRUNCATE TABLE `catalog_product_entity_decimal`;<br \/>\nTRUNCATE TABLE `catalog_product_entity_gallery`;<br \/>\ntruncate table `catalog_product_entity_group_price`;<br \/>\nTRUNCATE TABLE `catalog_product_entity_int`;<br \/>\nTRUNCATE TABLE `catalog_product_entity_media_gallery`;<br \/>\nTRUNCATE TABLE `catalog_product_entity_media_gallery_value`;<br \/>\nTRUNCATE TABLE `catalog_product_entity_text`;<br \/>\nTRUNCATE TABLE `catalog_product_entity_tier_price`;<br \/>\nTRUNCATE TABLE `catalog_product_entity_varchar`;<br \/>\nTRUNCATE TABLE `catalog_product_flat_1`;<br \/>\nTRUNCATE TABLE `catalog_product_link`;<br \/>\nTRUNCATE TABLE `catalog_product_link_attribute_decimal`;<br \/>\nTRUNCATE TABLE `catalog_product_link_attribute_int`;<br \/>\nTRUNCATE TABLE `catalog_product_link_attribute_varchar`;<br \/>\nTRUNCATE TABLE `catalog_product_option`;<br \/>\nTRUNCATE TABLE `catalog_product_option_price`;<br \/>\nTRUNCATE TABLE `catalog_product_option_title`;<br \/>\nTRUNCATE TABLE `catalog_product_option_type_price`;<br \/>\nTRUNCATE TABLE `catalog_product_option_type_title`;<br \/>\nTRUNCATE TABLE `catalog_product_option_type_value`;<br \/>\nTRUNCATE TABLE `catalog_product_super_attribute_label`;<br \/>\nTRUNCATE TABLE `catalog_product_super_attribute_pricing`;<br \/>\nTRUNCATE TABLE `catalog_product_super_attribute`;<br \/>\nTRUNCATE TABLE `catalog_product_super_link`;<br \/>\nTRUNCATE TABLE `catalog_product_enabled_index`;<br \/>\nTRUNCATE TABLE `catalog_product_website`;<br \/>\nTRUNCATE TABLE `catalog_category_product_index`;<\/p>\n<p>TRUNCATE TABLE `catalog_category_product`;<\/p>\n<p>TRUNCATE TABLE `catalog_product_entity`;<br \/>\ntruncate table `catalog_product_relation`;<\/p>\n<p>TRUNCATE TABLE `cataloginventory_stock_item`;<br \/>\nTRUNCATE TABLE `cataloginventory_stock_status`;<br \/>\nSET FOREIGN_KEY_CHECKS = 1;<br \/>\n[\/code] <\/p>\n","protected":false},"excerpt":{"rendered":"<p>It doesn&#8217;t happen often, but sometimes I need to wipe all products from a magento database during development. Either an import was written slightly off, or it was just full&#8230; <a href=\"https:\/\/www.evermoretechnologies.com\/blog\/2014\/02\/deleting-all-products-from-a-magento-database-with-sql\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[23],"tags":[],"_links":{"self":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/226"}],"collection":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=226"}],"version-history":[{"count":0,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/226\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.evermoretechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}