Using database and uninstalling

Permalink 1 user found helpful
I'm creating a package and a job in the package uses db tables. The tables defined in db.xml are created with installation.

Are the tables removed with uninstall or should that be done in the packagecontroller's uninstall function?

Thanks!

SnefIT
 
jordanlev replied on at Permalink Reply
jordanlev
No, tables are not removed automatically upon uninstallation -- you need to code this up in your package controller's uninstall() method.

Note that there are some situations where you might not want to delete the tables -- it's very possible someone might accidentally uninstall an addon but then want to reinstall it. If the addon had "important" information saved with it (for example, all of the submitted forms from customers or all order histories for eCommerce), it might be best to just leave the tables intact -- that way the data can be recovered in case the addon was removed accidentally or someone changed their mind.