I've created a custom module to be used for deploying configuration updates like enabaling modules, reverting features, executing db queries, etc...

The module initially has an empty .module file, a .info file and a .install file with three hook_update_n functions.

When I enable the module, the schema version is set to the last "n" value of the update hooks, but the functions inside those hooks aren't executed.

What's the proper way to enable a "utility" module like this during deployment, and still run the update hooks via update.php?

Should the functions go in a hook_install instead?

Seems like a "who's on first" type problem.

Thank you.

  • It seems like a logical thing to do, to put those functions into the hook_install since it's the first time you're enabling the module. Or you can try to enable it without the hook_update_n functions (cut them out), then after enabling it, add it back into the .install and run the db update.
    – Beebee
    Sep 27, 2013 at 13:54
  • I encountered this very same problem today. Seems so straight-forward, but not. Did you find a solution to this?
    – Randell
    Mar 14, 2014 at 6:01

1 Answer 1


A module with an install file gets run at install, for an example if you install/enable a module with one hook_install and three hook_update_ only the hook_install will be ran.

The best way to do what you want to do is create a module like you want, with a empty hook_install then just keep adding hook_update_ functions as you need to do more stuff, then when you are done run update.php to run all the hooks.

It may also be a good idea to separate the types of stuff you want to do into groups (like create new items, and add them to the database, then another hook could be delete x and y, and another could be rename a and b) and add them as hook_update_ so for example if you need to run something more then once for an example or maybe down the road, you could just call update.php and run that specific hook_update_ function (if you for example wanted to run delete x and y more then once, you can).


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.