Reinstalling Magento Modules

Just a quick note, but it seems that despite having the whole <version> thing going on in config files, Magento doesn’t actively do a version diff and reload a new module. If you want the system to reload the module (and re-run any database setup, etc.) take a look in the core_resource table.

| code                    | version |
| adminnotification_setup | 1.0.0   | 
| admin_setup             | 0.7.1   | 
| etc ...                 |   ...   | 

Just delete your module from this table and then clear Magento’s cache. That should be all it takes to re-load the new module into the system.

Update: What I said above about the versions being meaningless isn’t correct. The mysql4-install-X.X.X.php files will only be run once by the system. However, by changing the version value in your XML config, you’re telling the system which install file it should be looking for. So, for example

//this in your config

//would load this sql install file

When you’re deploying new versions of a module, be sure to change the version of your install script. During development though, it’s still best to just delete the record from your core_resource table.

Like this article? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Read more about Magento
Originally published April 16, 2009