# Plugin deinstallieren - Tabelle löschen

**URL:** https://forum.shopware.com/t/plugin-deinstallieren-tabelle-loschen/1836
**Category:** Shopware 3.5
**Tags:** programming
**Created:** [17. Februar 2011 um 10:16 UTC](https://forum.shopware.com/t/plugin-deinstallieren-tabelle-loschen/1836 "2011-02-17T10:16:49Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ottscho](https://avatars.discourse-cdn.com/v4/letter/o/7ba0ec/32.png) [@ottscho](https://forum.shopware.com/u/ottscho)
#### Post date: [17. Februar 2011 um 10:16 UTC](https://forum.shopware.com/t/plugin-deinstallieren-tabelle-loschen/1836/1 "2011-02-17T10:16:49Z")

</div>

Hey Stefan, ich Erstelle bei einer Plugin-Installation eine Tabelle (so wie du es mir geraten hast:) ). Wie bekomme ich die bei der Deinstallation wieder los? So klappt es leider nicht. Danke für deine Hilfe. ` public function install() { $sql = " CREATE TABLE s\_plugin\_OrderActivation (id INT NOT NULL AUTO\_INCREMENT PRIMARY KEY, orderID INT(11), orderhash VARCHAR(20))"; Shopware()-\>Db()-\>exec($sql); $event = $this-\>createEvent( 'Enlight\_Controller\_Dispatcher\_ControllerPath\_Frontend\_OrderActivation', 'onGetControllerPath'); $this-\>subscribeEvent($event); return true; } public function deinstall() { $sql = " DROP TABLE s\_plugin\_OrderActivation"; Shopware()-\>Db()-\>exec($sql); return true; } `

---

<div class="post-metadata">

### Author: ![Stefan\_Hamann](https://avatars.discourse-cdn.com/v4/letter/s/5e9695/32.png) [@Stefan\_Hamann](https://forum.shopware.com/u/Stefan_Hamann)
#### Post date: [17. Februar 2011 um 10:26 UTC](https://forum.shopware.com/t/plugin-deinstallieren-tabelle-loschen/1836/2 "2011-02-17T10:26:30Z")

</div>

Die Methode heißt uninstall und nicht deinstall

---

<div class="post-metadata">

### Author: ![Heiner\_Lohaus](https://avatars.discourse-cdn.com/v4/letter/h/b5a626/32.png) [@Heiner\_Lohaus](https://forum.shopware.com/u/Heiner_Lohaus)
#### Post date: [17. Februar 2011 um 11:10 UTC](https://forum.shopware.com/t/plugin-deinstallieren-tabelle-loschen/1836/3 "2011-02-17T11:10:46Z")

</div>

Beispiel: ` public function uninstall() { $sql = 'DROP TABLE IF EXISTS `s_plugin_customizing_groups`;'; Shopware()-\>Db()-\>exec($sql); $sql = 'DROP TABLE IF EXISTS `s_plugin_customizing_options`;'; Shopware()-\>Db()-\>exec($sql); $sql = 'DROP TABLE IF EXISTS `s_plugin_customizing_values`;'; Shopware()-\>Db()-\>exec($sql); $sql = 'DROP TABLE IF EXISTS `s_plugin_customizing_values`;'; Shopware()-\>Db()-\>exec($sql); $sql = 'DELETE FROM `s_core_engine_queries` WHERE `query` LIKE ?'; Shopware()-\>Db()-\>query($sql, array('%s\_plugin\_customizing\_groups%')); $field = $this-\>Config()-\>field; $sql = 'DELETE FROM `s_core_engine_elements` WHERE `databasefield`=?'; Shopware()-\>Db()-\>query($sql, array($field)); return parent::uninstall(); }`

---

<div class="post-metadata">

### Author: ![ottscho](https://avatars.discourse-cdn.com/v4/letter/o/7ba0ec/32.png) [@ottscho](https://forum.shopware.com/u/ottscho)
#### Post date: [17. Februar 2011 um 11:13 UTC](https://forum.shopware.com/t/plugin-deinstallieren-tabelle-loschen/1836/4 "2011-02-17T11:13:57Z")

</div>

danke euch Beiden 😉
