Skip to content

Add Drush command to determine the next update hook and scaffold boilerplate #6421

@Grashunk

Description

@Grashunk

Is your feature request related to a problem? Please describe.
When working on Drupal updates, teams frequently need to add new hook_update_N() or hook_post_update_NAME() implementations. Determining the next valid update ID and creating the correct boilerplate is repetitive and error-prone. Developers often guess an ID, run drush updb, and see “No updates pending,” because that ID has already run or was removed from code. This slows iteration and causes confusion across environments.

Describe the solution you'd like
Introduce a Drush command that discovers the next valid update hook ID for a given module and can scaffold a ready-to-use boilerplate file/function.

Describe alternatives you've considered
Manually checking via:
drush php:eval 'print_r(\Drupal::keyValue("system.schema")->get("my_module"));'
Then hand-crafting files and function names. Works, but is slow, inconsistent, and not CI-friendly.

Project-local scripts. Not reusable, drift across teams.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions