Leeren aller relevanten Magento-Tabellen

Zum Erstellen eines Demo-Shops kann es notwendig sein, vorher die Datenbank von allen unnötigen Datensätzen zu bereinigen. Um diese Arbeit nicht mühsam von Hand zu erledigen, können folgenden Queries helfen.

Für die roten Fragezeichen müssen die jeweiligen Store-IDs eingesetzt werden.

Löschen aller Kategorien:

SET FOREIGN_KEY_CHECKS = 0;

TRUNCATE TABLE `magecatalog_category_entity`;
TRUNCATE TABLE `magecatalog_category_entity_datetime`;
TRUNCATE TABLE `magecatalog_category_entity_decimal`;
TRUNCATE TABLE `magecatalog_category_entity_int`;
TRUNCATE TABLE `magecatalog_category_entity_text`;
TRUNCATE TABLE `magecatalog_category_entity_varchar`;
TRUNCATE TABLE `magecatalog_category_product`;
TRUNCATE TABLE `magecatalog_category_product_index`;
TRUNCATE TABLE `magecatalog_category_flat_store_?`;
TRUNCATE TABLE `magecatalog_category_flat_store_?`;

SET FOREIGN_KEY_CHECKS = 1;

Löschen aller Kundendaten:

SET FOREIGN_KEY_CHECKS=0;

-- Customers
TRUNCATE `magecustomer_address_entity`;
TRUNCATE `magecustomer_address_entity_datetime`;
TRUNCATE `magecustomer_address_entity_decimal`;
TRUNCATE `magecustomer_address_entity_int`;
TRUNCATE `magecustomer_address_entity_text`;
TRUNCATE `magecustomer_address_entity_varchar`;
TRUNCATE `magecustomer_entity`;
TRUNCATE `magecustomer_entity_datetime`;
TRUNCATE `magecustomer_entity_decimal`;
TRUNCATE `magecustomer_entity_int`;
TRUNCATE `magecustomer_entity_text`;
TRUNCATE `magecustomer_entity_varchar`;
ALTER TABLE `magecustomer_address_entity` AUTO_INCREMENT=1;
ALTER TABLE `magecustomer_address_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `magecustomer_address_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `magecustomer_address_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `magecustomer_address_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `magecustomer_address_entity_varchar` AUTO_INCREMENT=1;
ALTER TABLE `magecustomer_entity` AUTO_INCREMENT=1;
ALTER TABLE `magecustomer_entity_datetime` AUTO_INCREMENT=1;
ALTER TABLE `magecustomer_entity_decimal` AUTO_INCREMENT=1;
ALTER TABLE `magecustomer_entity_int` AUTO_INCREMENT=1;
ALTER TABLE `magecustomer_entity_text` AUTO_INCREMENT=1;
ALTER TABLE `magecustomer_entity_varchar` AUTO_INCREMENT=1;

-- Search
TRUNCATE `magecatalogsearch_query`;
TRUNCATE `magecatalogsearch_fulltext`;
TRUNCATE `magecatalogsearch_result`;
ALTER TABLE `magecatalogsearch_query` AUTO_INCREMENT=1;
ALTER TABLE `magecatalogsearch_fulltext` AUTO_INCREMENT=1;
ALTER TABLE `magecatalogsearch_result` AUTO_INCREMENT=1;

-- Polls
TRUNCATE `magepoll`;
TRUNCATE `magepoll_answer`;
TRUNCATE `magepoll_store`;
TRUNCATE `magepoll_vote`;
ALTER TABLE `magepoll` AUTO_INCREMENT=1;
ALTER TABLE `magepoll_answer` AUTO_INCREMENT=1;
ALTER TABLE `magepoll_store` AUTO_INCREMENT=1;
ALTER TABLE `magepoll_vote` AUTO_INCREMENT=1;

-- Reports
TRUNCATE `magereport_viewed_product_index`;
ALTER TABLE `magereport_viewed_product_index` AUTO_INCREMENT=1;

-- Newsletter
TRUNCATE `magenewsletter_queue`;
TRUNCATE `magenewsletter_queue_link`;
TRUNCATE `magenewsletter_subscriber`;
TRUNCATE `magenewsletter_problem`;
TRUNCATE `magenewsletter_queue_store_link`;
ALTER TABLE `magenewsletter_queue` AUTO_INCREMENT=1;
ALTER TABLE `magenewsletter_subscriber` AUTO_INCREMENT=1;
ALTER TABLE `magenewsletter_problem` AUTO_INCREMENT=1;
ALTER TABLE `magenewsletter_queue_store_link` AUTO_INCREMENT=1;

SET FOREIGN_KEY_CHECKS=1;

Löschen aller Protokolle:

SET FOREIGN_KEY_CHECKS=0;

TRUNCATE `magelog_customer`;
TRUNCATE `magelog_visitor`;
TRUNCATE `magelog_visitor_info`;
TRUNCATE `magelog_visitor_online`;
TRUNCATE `magelog_quote`;
TRUNCATE `magelog_summary`;
TRUNCATE `magelog_summary_type`;
TRUNCATE `magelog_url`;
TRUNCATE `magelog_url_info`;
TRUNCATE `magesendfriend_log`;
TRUNCATE `magereport_event`;
TRUNCATE `magedataflow_batch_import`;
TRUNCATE `magedataflow_batch_export`;
TRUNCATE `mageindex_process_event`;
TRUNCATE `mageindex_event`;
ALTER TABLE `magelog_customer` AUTO_INCREMENT=1;
ALTER TABLE `magelog_visitor` AUTO_INCREMENT=1;
ALTER TABLE `magelog_visitor_info` AUTO_INCREMENT=1;
ALTER TABLE `magelog_visitor_online` AUTO_INCREMENT=1;
ALTER TABLE `magelog_quote` AUTO_INCREMENT=1;
ALTER TABLE `magelog_summary` AUTO_INCREMENT=1;
ALTER TABLE `magelog_url_info` AUTO_INCREMENT=1;
ALTER TABLE `magesendfriend_log` AUTO_INCREMENT=1;
ALTER TABLE `magereport_event` AUTO_INCREMENT=1;
ALTER TABLE `magedataflow_batch_import` AUTO_INCREMENT=1;
ALTER TABLE `magedataflow_batch_export` AUTO_INCREMENT=1;
ALTER TABLE `mageindex_event` AUTO_INCREMENT=1;

-- Enterprise Edition
TRUNCATE `mageenterprise_logging_event`;
TRUNCATE `mageenterprise_logging_event_changes`;
ALTER TABLE `mageenterprise_logging_event` AUTO_INCREMENT=1;
ALTER TABLE `mageenterprise_logging_event_changes` AUTO_INCREMENT=1;

SET FOREIGN_KEY_CHECKS=1;

Löschen aller Produkte:

SET FOREIGN_KEY_CHECKS = 0;

TRUNCATE TABLE `magecatalog_product_bundle_option`;
TRUNCATE TABLE `magecatalog_product_bundle_option_value`;
TRUNCATE TABLE `magecatalog_product_bundle_selection`;
TRUNCATE TABLE `magecatalog_product_entity_datetime`;
TRUNCATE TABLE `magecatalog_product_entity_decimal`;
TRUNCATE TABLE `magecatalog_product_entity_gallery`;
TRUNCATE TABLE `magecatalog_product_entity_int`;
TRUNCATE TABLE `magecatalog_product_entity_media_gallery`;
TRUNCATE TABLE `magecatalog_product_entity_media_gallery_value`;
TRUNCATE TABLE `magecatalog_product_entity_text`;
TRUNCATE TABLE `magecatalog_product_entity_tier_price`;
TRUNCATE TABLE `magecatalog_product_entity_varchar`;
TRUNCATE TABLE `magecatalog_product_link`;
TRUNCATE TABLE `magecatalog_product_link_attribute`;
TRUNCATE TABLE `magecatalog_product_link_attribute_decimal`;
TRUNCATE TABLE `magecatalog_product_link_attribute_int`;
TRUNCATE TABLE `magecatalog_product_link_attribute_varchar`;
TRUNCATE TABLE `magecatalog_product_link_type`;
TRUNCATE TABLE `magecatalog_product_option`;
TRUNCATE TABLE `magecatalog_product_option_price`;
TRUNCATE TABLE `magecatalog_product_option_title`;
TRUNCATE TABLE `magecatalog_product_option_type_price`;
TRUNCATE TABLE `magecatalog_product_option_type_title`;
TRUNCATE TABLE `magecatalog_product_option_type_value`;
TRUNCATE TABLE `magecatalog_product_super_attribute`;
TRUNCATE TABLE `magecatalog_product_super_attribute_label`;
TRUNCATE TABLE `magecatalog_product_super_attribute_pricing`;
TRUNCATE TABLE `magecatalog_product_super_link`;
TRUNCATE TABLE `magecatalog_product_enabled_index`;
TRUNCATE TABLE `magecatalog_product_website`;
TRUNCATE TABLE `magecatalog_product_entity`;
TRUNCATE TABLE `magecataloginventory_stock`;
TRUNCATE TABLE `magecataloginventory_stock_item`;
TRUNCATE TABLE `magecataloginventory_stock_status`;
TRUNCATE TABLE `magecatalog_category_entity`;
TRUNCATE TABLE `magecatalog_category_entity_datetime`;
TRUNCATE TABLE `magecatalog_category_entity_decimal`;
TRUNCATE TABLE `magecatalog_category_entity_int`;
TRUNCATE TABLE `magecatalog_category_entity_text`;
TRUNCATE TABLE `magecatalog_category_entity_varchar`;
TRUNCATE TABLE `magecatalog_category_product`;
TRUNCATE TABLE `magecatalog_category_product_index`;
TRUNCATE TABLE `magecatalog_product_relation`;
TRUNCATE TABLE `magecatalog_product_flat_?`;
TRUNCATE TABLE `magecatalog_product_flat_?`;
TRUNCATE TABLE `magecatalog_category_flat_store_?`;
TRUNCATE TABLE `magecatalog_category_flat_store_?`;

SET FOREIGN_KEY_CHECKS = 1;

Löschen aller Bestellungen:

SET FOREIGN_KEY_CHECKS=0;

TRUNCATE `magesales_payment_transaction`;
TRUNCATE `magesales_flat_creditmemo`;
TRUNCATE `magesales_flat_creditmemo_comment`;
TRUNCATE `magesales_flat_creditmemo_grid`;
TRUNCATE `magesales_flat_creditmemo_item`;
TRUNCATE `magesales_flat_order`;
TRUNCATE `magesales_flat_order_address`;
TRUNCATE `magesales_flat_order_grid`;
TRUNCATE `magesales_flat_order_item`;
TRUNCATE `magesales_flat_order_status_history`;
TRUNCATE `magesales_flat_quote`;
TRUNCATE `magesales_flat_quote_address`;
TRUNCATE `magesales_flat_quote_address_item`;
TRUNCATE `magesales_flat_quote_item`;
TRUNCATE `magesales_flat_quote_item_option`;
TRUNCATE `magesales_flat_order_payment`;
TRUNCATE `magesales_flat_quote_payment`;
TRUNCATE `magesales_flat_quote_shipping_rate`;
TRUNCATE `magesales_flat_shipment`;
TRUNCATE `magesales_flat_shipment_item`;
TRUNCATE `magesales_flat_shipment_grid`;
TRUNCATE `magesales_flat_shipment_track`;
TRUNCATE `magesales_flat_invoice`;
TRUNCATE `magesales_flat_invoice_grid`;
TRUNCATE `magesales_flat_invoice_item`;
TRUNCATE `magesales_flat_invoice_comment`;
TRUNCATE `magetag`;
TRUNCATE `magetag_relation`;
TRUNCATE `magetag_summary`;
TRUNCATE `magewishlist`;
TRUNCATE `magereport_event`;
TRUNCATE `magecatalogsearch_fulltext`;

-- Reports
TRUNCATE `magesales_bestsellers_aggregated_daily`;
TRUNCATE `magesales_bestsellers_aggregated_monthly`;
TRUNCATE `magesales_bestsellers_aggregated_yearly`;
TRUNCATE `magesales_invoiced_aggregated`;
TRUNCATE `magesales_invoiced_aggregated_order`;
TRUNCATE `magesales_order_aggregated_created`;
TRUNCATE `magesales_order_aggregated_updated`;
TRUNCATE `magesales_refunded_aggregated`;
TRUNCATE `magesales_refunded_aggregated_order`;
TRUNCATE `magesales_shipping_aggregated`;
TRUNCATE `magesales_shipping_aggregated_order`;
TRUNCATE `magecoupon_aggregated`;
TRUNCATE `magereview`;
TRUNCATE `magereview_detail`;
TRUNCATE `magereview_entity_summary`;
TRUNCATE `magerating_store`;

-- Enterprise Edition
TRUNCATE `mageenterprise_reward`;
TRUNCATE `mageenterprise_reward_history`;
TRUNCATE `mageenterprise_customer_sales_flat_quote_address`;
TRUNCATE `mageenterprise_customer_sales_flat_quote`;
TRUNCATE `mageenterprise_customer_sales_flat_order_address`;
TRUNCATE `mageenterprise_customer_sales_flat_order`;

ALTER TABLE `magesales_payment_transaction` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_creditmemo` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_creditmemo_comment` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_creditmemo_grid` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_creditmemo_item` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_order` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_order_address` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_order_grid` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_order_item` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_order_status_history` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_quote` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_quote_address` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_quote_address_item` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_quote_item` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_quote_item_option` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_order_payment` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_quote_payment` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_quote_shipping_rate` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_shipment` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_shipment_item` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_invoice` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_invoice_grid` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_invoice_item` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_invoice_comment` AUTO_INCREMENT=1;
ALTER TABLE `magesales_flat_shipment_grid` AUTO_INCREMENT=1;
ALTER TABLE `magetag` AUTO_INCREMENT=1;
ALTER TABLE `magetag_relation` AUTO_INCREMENT=1;
ALTER TABLE `magetag_summary` AUTO_INCREMENT=1;
ALTER TABLE `magewishlist` AUTO_INCREMENT=1;
ALTER TABLE `magereport_event` AUTO_INCREMENT=1;
ALTER TABLE `magecatalogsearch_fulltext` AUTO_INCREMENT=1;

--
-- Enterprise Edition
-- 
ALTER TABLE `mageenterprise_reward` AUTO_INCREMENT=1;
ALTER TABLE `mageenterprise_reward_history` AUTO_INCREMENT=1;
ALTER TABLE `mageenterprise_customer_sales_flat_quote_address` AUTO_INCREMENT=1;
ALTER TABLE `mageenterprise_customer_sales_flat_quote` AUTO_INCREMENT=1;
ALTER TABLE `mageenterprise_customer_sales_flat_order_address` AUTO_INCREMENT=1;
ALTER TABLE `mageenterprise_customer_sales_flat_order` AUTO_INCREMENT=1;

TRUNCATE `mageeav_entity_store`;
ALTER TABLE `mageeav_entity_store` AUTO_INCREMENT=1;

SET FOREIGN_KEY_CHECKS=1;

Leave A Comment?

You must be logged in to post a comment.