DB Updates fail silently when update dependencies are wrong

Created on 12 September 2023, over 1 year ago

Problem/Motivation

drush updb

--------------------------------------------------------------------
 Module             Update ID   Type                 Description
--------------------------------------------------------------------
 user               10000       hook_update_n        ....

 [success] Finished performing updates.

It seems everything is ok, but the update and any subsequent update will not run if we have a bad hook_update_dependencies implementation. There is no error or warning. The only indication is that the updates are not running, but no explanation why.

Steps to reproduce

Implement hook_update_dependencies with a non existent dependency. Then try to run the pending updates (with drush updb).

function mymodule_update_dependencies() {
  // Make sure our update hook runs first.
  $dependencies['user'][10000] = [
    'non_existent_update' => 10001,
  ];

  return $dependencies;
}

Proposed resolution

Would like to see an error like this:

[notice] Update user_update_10000 has an unmet dependency and can not start.
[error] The update function non_existent_update_update_10001 does not exist.

[error] Update aborted by: user_update_10000

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

10.1

Component
Database update 

Last updated 11 days ago

No maintainer
Created by

🇭🇺Hungary pasqualle 🇭🇺 Budapest

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024