Uninstall a module before deleting it

I regularly come across a client's Drupal database and see that it's lingered with left-over tables and settings. These tables are often from modules that were installed during previous Drupal versions or that were ditched altogether. Here's a good tip: uninstall a module before deleting it. Most modules come with an uninstall function that cleans up any used tables and variables, keeping your database nice and tidy. Do note that you still need the module on your server to be able to uninstall it.

So when you're getting rid of a module, go to admin/build/modules and click on "Uninstall". After you've uninstalled them, you're safe to remove the modules from your server.

Also a note for module maintainers: there's still a whole lot of modules out there that install a bunch of tables and variables but that don't use hook_uninstall() to get rid of them. With the Drupal 6 schema API it's even easier to delete all this data.

Comments

You're absolutely right.

Hey, Wim. I'm ashamed to admit that I always forget this step. Thanks for the reminder.

Many usefull modules do not

Many usefull modules do not provide uninstall function 8(
In my database there are some tables from old modules and I have to drop them by hands

what about ??

what about the modules which do not provide the uninstall function? How can i get rid off the tables in my database?

thanks in advance.

The only way to get rid of

The only way to get rid of those tables is to remove them manually. There will usually also be some entries in the {variables} table that need to be removed. The best thing to do is to create an issue in the project's queue on drupal.org.

Post new comment

The content of this field is kept private and will not be shown publicly.