Recently, I encounter a login issue after updating Drupal from 10.0 to 10.1. https://www.drupal.org/project/drupal/issues/3370483
The solution was to manually run update after running a composer update command.

Although I have been using Drupal for a while, I have not been running the update script and, luckily, not encountered an issue until now.

For new developers (and forgetful ones), it may not be immediately obvious this is required.

The current experience:
- composer update
- Login to site
- Visit '/admin/reports'
- Click "status report"
- Scroll down to check for Database updates
- If exists, click `update`

Proposed resolution

Suggested experience:
- composer update

Composer supports various command event scripts that act similar to hooks for common commands.

Using this, we can automate scripts _after_ developers run composer update.
Something similar to:

    "scripts": {
        "post-update-cmd": [
            "drush updb -y"
        ]
    },

The above _example_ illustrators a working implementation when the project has drush installed. Not ever project has Drush so we would need to implment our own script which does the functional equavilent.

This is a repost of issue which I was closed as a duplicate and refered to Automatic Updates initiative. This request is a subset however, and not about checking for updates, verifiying compatability, download and installing. This request is automatically running the database updates, after a developer has specifically asked composer to update a package.

Comments

tyler36 created an issue. See original summary.

tyler36’s picture

Even a message output of "Please check for database updates by visiting the status page and clicking the link if required", run via the post-update-cmd would help new developer.

phenaproxima’s picture

Status: Active » Closed (works as designed)

This doesn't seem like it's in the scope of the Automatic Updates module, which has nothing to do with running database schema updates. So I think I'm gonna close the book on this one, but feel free to reopen if I've missed something.

tr’s picture

Status: Closed (works as designed) » Active

This doesn't seem like it's in the scope of the Automatic Updates module, which has nothing to do with running database schema updates.

I think the OP stated things well. Specifically, a lot of users, especially those coming from environments where every update task is handled by Composer, might be unaware of the need to separately check for and run database updates after updating the code with Composer. OR might be aware and just forget to do it. It happens to all of us, and in many cases a site can run perfectly fine for a long time even if the database update was neglected.

Ensuring that all the steps are taken, including database updates, seems to be fully in scope for this module. And in fact the project page itself says:

Automatically detects database updates in an incoming update, and helps you run them during the update process.

Likewise, as the OP stated, the Drupal core issue #3370815: Use composer scripts to automate schema update was closed by @cilefen and @longwave because, as they said, this issue is something that is being handled by the Automatic Updates initiative.

@phenaproxima: so please clarify - is this task something that belongs in Automatic Updates or does it belong in Core?

Using a composer script to automatically run update.php or to at a minimum output a message informing the user that updates need to be run (and how to run them) seems like a no-brainer improvement that will help stop some common problems and make Drupal easier to update. Which again, seems to be exactly what the Automatic Updates initiative is intended to do.