Skip to content

Instantly share code, notes, and snippets.

@emtii
Last active October 17, 2016 17:49
Show Gist options
  • Save emtii/dd84c4e9f130bd314fa6d73b8c8b7cf6 to your computer and use it in GitHub Desktop.
Save emtii/dd84c4e9f130bd314fa6d73b8c8b7cf6 to your computer and use it in GitHub Desktop.
Deletes Articles from Shopware 5.1.1
Description
====================================================================================================================
We basically need 2 steps to completely remove articles from this shopware version:
1. truncate mysql tables
2. use sw cli command to remove left images from filesystem
1. truncate
====================================================================================================================
SET foreign_key_checks = 0;
TRUNCATE `s_addon_premiums`;
TRUNCATE `s_article_configurator_dependencies`;
TRUNCATE `s_article_configurator_groups`;
TRUNCATE `s_article_configurator_option_relations`;
TRUNCATE `s_article_configurator_options`;
TRUNCATE `s_article_configurator_price_variations`;
TRUNCATE `s_article_configurator_set_group_relations`;
TRUNCATE `s_article_configurator_set_option_relations`;
TRUNCATE `s_article_configurator_sets`;
TRUNCATE `s_article_configurator_template_prices`;
TRUNCATE `s_article_configurator_template_prices_attributes`;
TRUNCATE `s_article_configurator_templates`;
TRUNCATE `s_article_configurator_templates_attributes`;
TRUNCATE `s_article_img_mapping_rules`;
TRUNCATE `s_article_img_mappings`;
TRUNCATE `s_articles`;
TRUNCATE `s_articles_also_bought_ro`;
TRUNCATE `s_articles_attributes`;
TRUNCATE `s_articles_avoid_customergroups`;
TRUNCATE `s_articles_categories`;
TRUNCATE `s_articles_categories_ro`;
TRUNCATE `s_articles_categories_seo`;
TRUNCATE `s_articles_details`;
TRUNCATE `s_articles_downloads`;
TRUNCATE `s_articles_downloads_attributes`;
TRUNCATE `s_articles_esd`;
TRUNCATE `s_articles_esd_attributes`;
TRUNCATE `s_articles_esd_serials`;
TRUNCATE `s_articles_img`;
TRUNCATE `s_articles_img_attributes`;
TRUNCATE `s_articles_information`;
TRUNCATE `s_articles_information_attributes`;
TRUNCATE `s_articles_notification`;
TRUNCATE `s_articles_prices`;
TRUNCATE `s_articles_prices_attributes`;
TRUNCATE `s_articles_relationships`;
TRUNCATE `s_articles_similar`;
TRUNCATE `s_articles_similar_shown_ro`;
TRUNCATE `s_articles_top_seller_ro`;
TRUNCATE `s_articles_translations`;
TRUNCATE `s_articles_vote`;
TRUNCATE `s_filter`;
TRUNCATE `s_filter_articles`;
TRUNCATE `s_filter_attributes`;
TRUNCATE `s_filter_options`;
TRUNCATE `s_filter_relations`;
TRUNCATE `s_filter_values`;
DELETE FROM `s_media` WHERE `albumID` = -1;
SET foreign_key_checks = 1;
2. cli command
====================================================================================================================
php bin/console sw:media:cleanup --delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment