I have a module I wrote that is used on a production site. I had to make some changes and need to update the module.

Where do I begin to learn to do this?

  • can you be more specific about what it is in your module that you are trying to update? hard to tell what you need since this module was custom to begin with ..
    – schnippy
    Jul 8, 2012 at 18:18
  • It has updates to my custom node types, a schema change, and code changes to the .module file (and install file for future installs).
    – vintorg
    Jul 8, 2012 at 20:28

1 Answer 1


"Updating a module" can comprise of two things:

  1. If it's just code, then simply replacing the old code with the new code should be sufficient. However, when your code is complex or you are working in a multi-user environment, it is best to bring your code under version control like svn or git (as you have tagged), and maintain it with branches and tags depending on the version of Drupal that you are working with.
  2. If your module also involved database updates, then you will need to become familiar both with the .install file as well as hook_update_n() functions. The documentation for the latter along with source examples from the .install files of core modules should guide you to creating update functions correctly.

On a related note, if your custom code is generic enough to be of use to the rest of the community, you can post it as a Drupal project and leverage drupal.org's project management feature which comes with git access.

You should also test everything out on a development server rather than on the production site. Adding lots of documentation to your update functions as well as maintaining a CHANGELOG.txt is also recommended.

  • Thank you coleopterist! I will check out the update functions. No worries on testing, I've been coding for a long time and always bang on my code in a test environment :-)
    – vintorg
    Jul 8, 2012 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.