Is it possible to force your module's update hook to run? I am the author of the Date iCal module, and the new major version I'm working on (3.x) requires a two-part schema update for users who had 2.x installed. I've written the update hook that makes these changes, but if one of my users fails to run the database update script, they will get an error message relating to their iCal feeds importers. 

The right solution is for them to run the update script... but if they just go in and manually change their importers to get rid of the message, their importers will remain permanently broken (because the second part of the schema update won't have been executed).

So is there any way to display a message to users who haven't run the update? Or somehow forcibly execute the update hook the first time a page load occurs when 3.x gets installed overtop of 2.x?
There are few ways of forcing module update.


Calling the update function directly.

$sandbox = [];
module_load_include('install', 'FOO');
FOO_update_7001($sandbox);

Resetting the schema version to the point of interest and run the updates again as usual.

drupal_set_installed_schema_version('module_name', '7000');


Or reset to re-run only the latest update schema:

drupal_set_installed_schema_version('foo', drupal_get_installed_schema_version('foo') - 1);


Notes:


This can be placed in hook_install, so during the update process all sequent update hooks would be executed.
In order to use this function outside of the installation file, you've to include Drupal install.inc first and installation file of the module, e.g.

require_once DRUPAL_ROOT . '/includes/install.inc';
module_load_include('install', 'foo');

Consider adding ini_set('max_execution_time', 0); for longer installation updates to prevent PHP timeouts.

Using drush. Find below few examples:


drush eval 'module_load_include('install', 'foo'); $s = []; foo_update_7001($s);'
drush sqlq "UPDATE system SET schema_version = 7000 WHERE name = 'foo'" &amp;&amp; drush -y updb