Why does my Drupal module update hook run more than once?

Posted by David Porter on June 10, 2015

That's a great question, and I am not really sure why; however, I do have an example of this and a solution that worked.

Here is a gist of an update hook that kept running each time I updated the Drupal installation:


As described above, each time I ran drush updb the update hook would run.

I determined that it kept running because the module schema version was never updating to match the update number (e.g. the "N" in hook_update_N). I do not know why it was not updating.

My solution: I simply added the following to be run when the update was complete and the hook stopped running on subsequent site updates:

drupal_set_installed_schema_version('rs', 7100);


Lemme know if this makes sense or helps at all.