How to deal with your custom module updates ?

At first, it can be hard to maintain and update your custom module but when you understand how it works, it’s pretty easy.

In your module.install file you will create a function for each update you want to make, for example, you forgot to add an agenda field in your content type :

Then, to update your module, just replace old files by the new ones. When you will run updates, Drupal will detect you were in version 7000 and will try to install the 7001 patch update. If you copy your module in a new Drupal installation and install it, the current version will be 7001 by default and the patch will be already installed automatically. You just need to increase this number each time you want to update your module. You won’t need to uninstall and install again your module each time you want to update it !

Leave a Reply

Your email address will not be published. Required fields are marked *

Post Navigation