How to Re-Run Updates In Drupal
This is how you can run a Drupal update again
Apr 11, 2024
When working on a hook update in Drupal, we likely have to run it multiple times to test it properly. While in Drupal 7 we could just update the schema_version column in the table system, from Drupal 8 and above is not that simple.
Luckily, we can do it with just one drush command:
drush ev "\Drupal::service('update.update_hook_registry')->setInstalledVersion('module_name', 9501);"
In the command above, replace module_name with the name of your module and 9501 with the previous hook_update id to the one you want to run.
π Find out more about me here: https://sergioguardiola.net π₯