How to Uninstall and Re-install a Drupal Module Properly

Dino Manrique's picture

This is just a reminder to myself -- and perhaps will help other Drupal webmasters -- of how to remove a module from the memory of a database. I encountered this when I was trying to remove and re-install Drupal's advertisement module. I couldn't re-install the module properly because some of the records related to the module was still in the database.

So there are two tables in the database that one needs to clean up so that your Drupal website will be made to think that the module concerned was never installed: the 'variable' table and the 'system' table. If you're using phpmyadmin for example, just delete all the records in the 'system' table whose name is your 'module', in this case it's 'advertisement.' Do the same in the 'variable' table; delete all the variables related to your module, in this case, e.g. 'ad_groups' or 'embed-ad-poll'.

Hope this post helps other Drupal users.