Drupal 7 update hook dependencies


You sometimes find that update hooks run in an unwanted order that affects their behaviour or creates errors and makes your site crash. You can override this and specify the order that you want with the following hook in your .install file.

<?php

  function new_module_update_dependencies() {
    // Run new_module update after old_module update. 
    $dependencies['new_module'][7001] = array(
      'old_module' => 7000, 
    ); 
    return $dependencies;
  }