Skip to content

Instantly share code, notes, and snippets.

@micronax
Last active September 27, 2017 14:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save micronax/6319186 to your computer and use it in GitHub Desktop.
Save micronax/6319186 to your computer and use it in GitHub Desktop.
Alle Shopware-Artikel aus der Datenbank entfernen + Media-DB für Artikel leeren. Achtung: Artikelbilder müssen noch manuell vom Server entfernt werden /media/img/
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `s_articles`;
TRUNCATE TABLE `s_articles_attributes`;
TRUNCATE TABLE `s_articles_categories`;
TRUNCATE TABLE `s_articles_categories_ro`;
TRUNCATE TABLE `s_articles_details`;
TRUNCATE TABLE `s_articles_img`;
TRUNCATE TABLE `s_articles_prices`;
TRUNCATE TABLE s_article_configurator_sets;
TRUNCATE TABLE s_article_configurator_set_group_relations;
TRUNCATE TABLE s_article_configurator_set_option_relations;
TRUNCATE TABLE s_article_configurator_option_relations;
TRUNCATE TABLE `s_articles_similar_shown_ro`;
TRUNCATE TABLE `s_articles_top_seller_ro`;
TRUNCATE TABLE `s_emarketing_lastarticles`;
TRUNCATE TABLE `s_filter_articles`;
DELETE FROM `s_media` WHERE `albumID` = -1;
SET FOREIGN_KEY_CHECKS = 1
@mpathy
Copy link

mpathy commented Sep 27, 2017

Ich denke man müsste das noch erweitern..

SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `s_articles`;
TRUNCATE TABLE `s_articles_attributes`;
TRUNCATE TABLE `s_articles_categories`;
TRUNCATE TABLE `s_articles_categories_ro`;
TRUNCATE TABLE `s_articles_details`;
TRUNCATE TABLE `s_articles_img`;
TRUNCATE TABLE `s_articles_img`;
TRUNCATE TABLE `s_articles_img_attributes`;
TRUNCATE TABLE `s_article_img_mappings`;
TRUNCATE TABLE `s_article_img_mapping_rules`;
TRUNCATE TABLE `s_articles_prices`;
TRUNCATE TABLE `s_article_configurator_sets`;
TRUNCATE TABLE `s_article_configurator_set_group_relations`;
TRUNCATE TABLE `s_article_configurator_set_option_relations`;
TRUNCATE TABLE `s_article_configurator_option_relations`;
TRUNCATE TABLE `s_articles_similar_shown_ro`;
TRUNCATE TABLE `s_articles_top_seller_ro`;
TRUNCATE TABLE `s_emarketing_lastarticles`;
TRUNCATE TABLE `s_filter_articles`;
UPDATE s_media SET albumID = -13 WHERE albumID = -1;
SET FOREIGN_KEY_CHECKS = 1

und im Anschluß die Bilder dann dann per cleanup aus dem Papierkorb löschen, wohin sie verschoben wurden um auf Nummer sicher zu gehen und nicht ausversehen mehr zu löschen als Sinn macht.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment