Upgrade 21 > 22 fails "Updates between multiple major versions and downgrades are unsupported"

I’ve migrated an instance of nextCloud to a new server. There I try to upgrade it, but it fails at the first step.

$ php7.4 occ upgrade
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
starting upgrade from to
Exception: Updates between multiple major versions and downgrades are unsupported.

Any idea what I’m missing or how to work around this?

Please use the search this question was asked lot of times already.

good recommendation AFAIK Adding feasibility check for updates before replacing the nextcloud files · Issue #617 · nextcloud/docker · GitHub

config.php value was correct.

After adding record (“core”, “vendor”, “nextcloud”) to table oc_appconfig upgrade started but it still failed:

Doctrine\DBAL\Schema\SchemaException: There is no column with name 'execution_duration' on table 'oc_jobs'.

After creating field

ADD execution_duration INT NULL 0;

I was able do the upgrade.

At first attempt I did

occ db:add-missing-indices
occ db:add-missing-columns
occ db:add-missing-primary-keys

It didn’t help and resulted in even more db errors during the upgrade. I dropped all tables, re-imported the db and skipped those steps in the next attempt to get the upgrade working.

21 to 22? I’m running Nextcloud 29. Why are you running such an outdated and obsolete version?

And wwe is correct, this identical question gets asked all the time. You should read some of the previous responses. Or better yet, wipe and install a current version of Nexcloud.

I’m still having trouble with this instance. After the adjustments I made to the database (described in my last post) I was able to do the upgrade and it’s now at 28.0.5.

People can’t log in and I get tons of error messages because of missing fields. I have no idea what’s been done with that instance before. When it was assigned to me it identified itself as nextcloud version and it was running without problems although it seems to me that the database was already damaged or at least missing a lot of fields (of course I still have a full backup of that state).

I’ve tried this in the initial state and at version 28:

occ db:add-missing-indices
occ db:add-missing-columns
occ db:add-missing-primary-keys

It didn’t help. Is there any other tool to check or even repair the database structure?

The errors I am currently dealing with are mostly like this:

An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘icon’ in ‘field list’

I have to analyse the source code to find out which table. Is there a debug level that includes full sql queries in the debug output?

You have to update at one major step at a time.

That’s good. Still, I usually try to avoid using .0 releases on life systems. Since 28 is still supported I’d rather wait until I upgrade to 29

I’d only do that as a very last resort. I don’t see how that’s better. Maybe I’m mistaken, but wouldn’t I lose all user accounts and all shares?

I did not find any tool that would reliably fix the database structure.

I’ve started new from the backup I had of nextCloud
I also did a clean dummy installation to have a reference database of nextcloud 21 and then exported the complete structure of each database to a single sql file and ran a diff comparison on them.
After fixing all the differences I was able to run occ maintenance:repair without errors.
After inserting the record (“core”, “vendor”, “nextcloud”) to table oc_appconfig, I did the upgrade to version 28 again.

So far everything seems to be working.

I should have been suspicious about the contradictions in that statement:

I was able to get nextcloud up and running with the steps I’ve mentioned in the last post. Still a few of the users weren’t able to log in. At last I realised (far too late), that the database backup I was provided with, was outdated. I requested a fresh database dump from the previous maintainer. That solved all the issues.

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.