6

It appears that the uninstall function in Magento Connect Manager only cleans up/reverts the source code added by a newly installed extension, not the data and the database schema changes.

After a day of trying and rejecting various extensions site builders end up with a messy database full of unused data.

It would be great for site builders and end users alike, if there was a way for an extension developer to somehow hook into the uninstall process and make their extension clean up after itself.

I know of CMS'es that offer this as core functionality out of the box.

Does anyone see a way to do this in Magento?

3
  • 1
    Unfortunately not. It has been tried here: github.com/magento-hackathon/MageTrashApp but tbh I don't know any extension that supports this Commented Jul 5, 2015 at 15:44
  • Thanks for the link @fschmengler! Looks like this daim2k5 had a good crack at it. But what we really need is for Magento core to call a function in the extension code during its execution of the uninstall process. Better still is for Magento core to make extensions implement an install_schema_changes function, which Magento core could then use to automagically "undo/execute in reverse" upon uninstall. This is how the Drupal CMS has done it for years and it works very well indeed. Does anyone know whether this functionality is being considered for Magento 2.x ?
    – fris
    Commented Jul 5, 2015 at 22:48
  • 1
    github.com/magento/magento2/issues/395 "Planned for Merchant Beta release (summer 2015)" Commented Jul 5, 2015 at 22:57

1 Answer 1

1

By default magento does not provide a way to undo database changes when removing modules. Some module provide will include a uninstall database script to run directly against the db.

To manually uninstall any module take a look at its install script and reverse the logic

It is always a good idea to do all testing in a development environment and make a backup copy of the database.

2
  • Most of the time, the way to undo database changes made by a module is to read the sql installer scripts used by the module and then manually reverse them using either command line sql, phpMyAdmin or another tool like NetCat that works directly with the database. If you get lucky, they may as pointed out above, include an uninstall script, but most omit this because a) it's extra work or b) they assume they have you by lock-in and you will never stop using their module. Don't use your live site or main dev install as a test bed for testing modules. It gets messy very quickly. Module conflicts! Commented Jul 5, 2015 at 15:23
  • Good answers... confirming the somewhat sad state of affair in Magento core. This really should be a standard feature...
    – fris
    Commented Jul 5, 2015 at 23:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.