Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PrestaShop: Delete all testing data before production

Tags:

prestashop

I'm searching a script to run on MySql to delete (truncate table) all the testing data (customer, order,cart, etc) on a PrestaShop database version 1.4.9. Thank Pascal

like image 766
user2145224 Avatar asked Dec 06 '22 09:12

user2145224


2 Answers

Install the Prestashop Cleaner and in configure you have options to delete catalog, orders and customers

like image 72
DSP Avatar answered Jan 22 '23 20:01

DSP


For 1.5.6.2 (probably works for 1.5.6*, even maybe for 1.5.*) :

TRUNCATE `ps_access`;
TRUNCATE `ps_address`;
TRUNCATE `ps_alias`;
TRUNCATE `ps_attribute`;
TRUNCATE `ps_attribute_group`;
TRUNCATE `ps_attribute_group_lang`;
TRUNCATE `ps_attribute_group_shop`;
TRUNCATE `ps_attribute_lang`;
TRUNCATE `ps_attribute_shop`;
TRUNCATE `ps_carrier`;
TRUNCATE `ps_carrier_group`;
TRUNCATE `ps_carrier_lang`;
TRUNCATE `ps_carrier_shop`;
TRUNCATE `ps_carrier_tax_rules_group_shop`;
TRUNCATE `ps_carrier_zone`;
TRUNCATE `ps_cart`;
TRUNCATE `ps_cart_product`;
TRUNCATE `ps_category`;
TRUNCATE `ps_category_group`;
TRUNCATE `ps_category_lang`;
TRUNCATE `ps_category_product`;
TRUNCATE `ps_category_shop`;
TRUNCATE `ps_cms`;
TRUNCATE `ps_cms_block`;
TRUNCATE `ps_cms_block_lang`;
TRUNCATE `ps_cms_block_page`;
TRUNCATE `ps_cms_block_shop`;
TRUNCATE `ps_cms_category`;
TRUNCATE `ps_cms_category_lang`;
TRUNCATE `ps_cms_lang`;
TRUNCATE `ps_cms_shop`;
TRUNCATE `ps_connections`;
TRUNCATE `ps_contact_lang`;
TRUNCATE `ps_contact_shop`;
TRUNCATE `ps_customer`;
TRUNCATE `ps_customer_group`;
TRUNCATE `ps_delivery`;
TRUNCATE `ps_feature`;
TRUNCATE `ps_feature_lang`;
TRUNCATE `ps_feature_shop`;
TRUNCATE `ps_feature_value`;
TRUNCATE `ps_feature_value_lang`;
TRUNCATE `ps_guest`;
TRUNCATE `ps_homeslider`;
TRUNCATE `ps_homeslider_slides`;
TRUNCATE `ps_homeslider_slides_lang`;
TRUNCATE `ps_image`;
TRUNCATE `ps_image_lang`;
TRUNCATE `ps_image_shop`;
TRUNCATE `ps_image_type`;
TRUNCATE `ps_manufacturer`;
TRUNCATE `ps_manufacturer_lang`;
TRUNCATE `ps_manufacturer_shop`;
TRUNCATE `ps_orders`;
TRUNCATE `ps_order_carrier`;
TRUNCATE `ps_order_cart_rule`;
TRUNCATE `ps_order_detail`;
TRUNCATE `ps_order_detail_tax`;
TRUNCATE `ps_order_history`;
TRUNCATE `ps_order_invoice`;
TRUNCATE `ps_order_invoice_payment`;
TRUNCATE `ps_order_invoice_tax`;
TRUNCATE `ps_order_message`;
TRUNCATE `ps_order_message_lang`;
TRUNCATE `ps_order_return_state`;
TRUNCATE `ps_order_return_state_lang`;
TRUNCATE `ps_order_state`;
TRUNCATE `ps_order_state_lang`;
TRUNCATE `ps_page`;
TRUNCATE `ps_page_type`;
TRUNCATE `ps_product`;
TRUNCATE `ps_product_attribute`;
TRUNCATE `ps_product_attribute_combination`;
TRUNCATE `ps_product_attribute_image`;
TRUNCATE `ps_product_attribute_shop`;
TRUNCATE `ps_product_lang`;
TRUNCATE `ps_product_shop`;
TRUNCATE `ps_product_supplier`;
TRUNCATE `ps_product_tag`;
TRUNCATE `ps_range_price`;
TRUNCATE `ps_range_weight`;
TRUNCATE `ps_reinsurance`;
TRUNCATE `ps_reinsurance_lang`;
TRUNCATE `ps_scene`;
TRUNCATE `ps_scene_category`;
TRUNCATE `ps_scene_lang`;
TRUNCATE `ps_scene_products`;
TRUNCATE `ps_scene_shop`;
TRUNCATE `ps_search_index`;
TRUNCATE `ps_search_word`;
TRUNCATE `ps_specific_price`;
TRUNCATE `ps_stock_available`;
TRUNCATE `ps_stock_mvt_reason`;
TRUNCATE `ps_stock_mvt_reason_lang`;
TRUNCATE `ps_store`;
TRUNCATE `ps_store_shop`;
TRUNCATE `ps_supplier`;
TRUNCATE `ps_supplier_lang`;
TRUNCATE `ps_supplier_shop`;
TRUNCATE `ps_supply_order_state`;
TRUNCATE `ps_supply_order_state_lang`;
TRUNCATE `ps_tag`;

Will give you a clean, ready database before you start.

like image 28
Cyril N. Avatar answered Jan 22 '23 20:01

Cyril N.