Update from 30.0.17 to 31.0.14 fails

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 30.0.17
  • PHP version (e.g, 8.3):
    • 8.2.29

Summary of the issue you are facing:

I was trying to update the existing Nextcloud 30.0.17 to 31.0.14:

php -d memory_limit=512M updater/updater.phar

However, it fails with:

Exception: Database error when running migration 31000Date20240821142813 for app files_sharing
An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column '`db12345`.`s`.`attributes`’ in ‘CHECK’

Any thoughts? I know nothing about Nextcloud internals so I’d be grateful to know the “obvious” things to try. I understand what the exception is telling me but I doubt that manually creating the column is the way to go.

Log entries

Nextcloud

This is the full output of update.phar:

Nextcloud Updater - version: v31.0.11-1-g6277d99 dirty

Current version is 31.0.14.

Update to Nextcloud 31.0.14 available. (channel: "stable")
Following file will be downloaded automatically: https://github.com/nextcloud-releases/server/releases/download/v31.0.14/nextcloud-31.0.14.zip
Open changelog ↗

Steps that will be executed:
[✔] Check for expected files
[✔] Check for write permissions
[✔] Create backup
[✔] Downloading
[✔] Verify integrity
[✔] Extracting
[✔] Enable maintenance mode
[✔] Replace entry points
[✔] Delete old files
[✔] Move new files in place
[✔] Done

Continue update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[✔] Check for expected files
[✔] Check for write permissions
[✔] Create backup
[✔] Downloading
[✔] Verify integrity
[✔] Extracting
[✔] Enable maintenance mode
[✔] Replace entry points
[✔] Delete old files
[✔] Move new files in place
[✔] Done

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] 
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Turned on maintenance mode
Repair step: Repair MySQL collation
Repair info: All tables already have the correct collation -> nothing to do
Repair step: Copy data from accounts table when migrating from ownCloud
Repair step: Drop account terms table when migrating from ownCloud
Updating database schema
Updated database
Updating <files_sharing> ...
Exception: Database error when running migration 31000Date20240821142813 for app files_sharing
An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column '`db12345`.`s`.`attributes`' in 'CHECK'
Update failed
Maintenance mode is kept active
Resetting log level

Keep maintenance mode active? [y/N] 
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Maintenance mode disabled

Maintenance mode is disabled

Configuration

Nextcloud

The output of occ config:list system

Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "30.0.17.2",
        "integrity.check.disabled": true,
        "default_language": "de",
        "default_locale": "de",
        "trashbin_retention_obligation": "auto, 30",
        "version_retention_obligation": "auto, 30",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "log_type": "file",
        "logfile": "\/dev\/null",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "nc_0057_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "maintenance": true,
        "theme": "",
        "loglevel": 2,
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

The issue seems to be the same one as the original one here which does not include a description of the solution, however.