Sunday, 3 May 2015

Delete Test Sales/Order data from Magento





To delete the test sales/Order data from magento run the below queries in your magento database --
  1. SET FOREIGN_KEY_CHECKS=0;
  2. ##############################
  3. # SALES RELATED TABLES
  4. ##############################
  5. TRUNCATE `sales_flat_creditmemo`;
  6. TRUNCATE `sales_flat_creditmemo_comment`;
  7. TRUNCATE `sales_flat_creditmemo_grid`;
  8. TRUNCATE `sales_flat_creditmemo_item`;
  9. TRUNCATE `sales_flat_invoice`;
  10. TRUNCATE `sales_flat_invoice_comment`;
  11. TRUNCATE `sales_flat_invoice_grid`;
  12. TRUNCATE `sales_flat_invoice_item`;
  13. TRUNCATE `sales_flat_order`;
  14. TRUNCATE `sales_flat_order_address`;
  15. TRUNCATE `sales_flat_order_grid`;
  16. TRUNCATE `sales_flat_order_item`;
  17. TRUNCATE `sales_flat_order_payment`;
  18. TRUNCATE `sales_flat_order_status_history`;
  19. TRUNCATE `sales_flat_quote`;
  20. TRUNCATE `sales_flat_quote_address`;
  21. TRUNCATE `sales_flat_quote_address_item`;
  22. TRUNCATE `sales_flat_quote_item`;
  23. TRUNCATE `sales_flat_quote_item_option`;
  24. TRUNCATE `sales_flat_quote_payment`;
  25. TRUNCATE `sales_flat_quote_shipping_rate`;
  26. TRUNCATE `sales_flat_shipment`;
  27. TRUNCATE `sales_flat_shipment_comment`;
  28. TRUNCATE `sales_flat_shipment_grid`;
  29. TRUNCATE `sales_flat_shipment_item`;
  30. TRUNCATE `sales_flat_shipment_track`;
  31. TRUNCATE `sales_invoiced_aggregated`; # ??
  32. TRUNCATE `sales_invoiced_aggregated_order`; # ??
  33. TRUNCATE `log_quote`;
  34. ALTER TABLE `sales_flat_creditmemo_comment` AUTO_INCREMENT=1;
  35. ALTER TABLE `sales_flat_creditmemo_grid` AUTO_INCREMENT=1;
  36. ALTER TABLE `sales_flat_creditmemo_item` AUTO_INCREMENT=1;
  37. ALTER TABLE `sales_flat_invoice` AUTO_INCREMENT=1;
  38. ALTER TABLE `sales_flat_invoice_comment` AUTO_INCREMENT=1;
  39. ALTER TABLE `sales_flat_invoice_grid` AUTO_INCREMENT=1;
  40. ALTER TABLE `sales_flat_invoice_item` AUTO_INCREMENT=1;
  41. ALTER TABLE `sales_flat_order` AUTO_INCREMENT=1;
  42. ALTER TABLE `sales_flat_order_address` AUTO_INCREMENT=1;
  43. ALTER TABLE `sales_flat_order_grid` AUTO_INCREMENT=1;
  44. ALTER TABLE `sales_flat_order_item` AUTO_INCREMENT=1;
  45. ALTER TABLE `sales_flat_order_payment` AUTO_INCREMENT=1;
  46. ALTER TABLE `sales_flat_order_status_history` AUTO_INCREMENT=1;
  47. ALTER TABLE `sales_flat_quote` AUTO_INCREMENT=1;
  48. ALTER TABLE `sales_flat_quote_address` AUTO_INCREMENT=1;
  49. ALTER TABLE `sales_flat_quote_address_item` AUTO_INCREMENT=1;
  50. ALTER TABLE `sales_flat_quote_item` AUTO_INCREMENT=1;
  51. ALTER TABLE `sales_flat_quote_item_option` AUTO_INCREMENT=1;
  52. ALTER TABLE `sales_flat_quote_payment` AUTO_INCREMENT=1;
  53. ALTER TABLE `sales_flat_quote_shipping_rate` AUTO_INCREMENT=1;
  54. ALTER TABLE `sales_flat_shipment` AUTO_INCREMENT=1;
  55. ALTER TABLE `sales_flat_shipment_comment` AUTO_INCREMENT=1;
  56. ALTER TABLE `sales_flat_shipment_grid` AUTO_INCREMENT=1;
  57. ALTER TABLE `sales_flat_shipment_item` AUTO_INCREMENT=1;
  58. ALTER TABLE `sales_flat_shipment_track` AUTO_INCREMENT=1;
  59. ALTER TABLE `sales_invoiced_aggregated` AUTO_INCREMENT=1;
  60. ALTER TABLE `sales_invoiced_aggregated_order` AUTO_INCREMENT=1;
  61. ALTER TABLE `log_quote` AUTO_INCREMENT=1;
  62. SET FOREIGN_KEY_CHECKS=1;
it will delete all test data and create new order with id '1' .
For such more Blogs you can visit to http://findnerd.com/NerdDigest

No comments:

Post a Comment