27th November 2014

Re-running update hooks with Drush

Dan James
Senior Developer

If you ever need to run an update hook again with drush you can often do this:

drush eval "module_load_install('module_name'); module_name_update_7012();" 

But! If that update is run as a batch then that won't work. So instead you can do this:

drush eval "drupal_set_installed_schema_version('module_name', '7011');" drush updb 

Which effectively rolls the module back to its old version number. Now, that saves you faffing about in the DB.

See the gist here.