Manually updating database after skipping major version upgrades

Hi,

I’m running Nextcloud from FreeBSD @Ports collection however, I haven’t upgraded the system for a while and as a result things are quite out of sync.
Trying to upgrade now and there was a problem stating that the ‘lazy’ and ‘type’ columns in the table ‘oc_appconfig’ were missing.

I am running Postgresql version 12. I logged into the db server and created the columns as such:

alter table oc_appconfig add lazy VARCHAR(255);
alter table oc_appconfig add type VARCHAR(255);

and now I’m getting this error:

Exception: Updates between multiple major versions and downgrades are unsupported.
Update failed

From what the DB states, the version of Nextcloud seems to be 26 while the webapp claiming 29.

After reading a little it seems that ‘skipping’ versions isn’t supported in NC, so I am not really sure what to do?

At this point I am wondering if there are any files with the DB upgrade commands available like some webapps have which of the type .sql format?

Basically so that I can manually run the necessary DB update steps to get the version to the current one without having to pull different versions of the webapp in then upgrade accordingly?

Or if the update commands are available elsewhere like github or something?? I’m trying to search but not having much luck unfortunately.

Thanks.

Well… I tried downloading NC version 27 then performing an incremental upgrade.

This is what I got:

sudo -u www php occ upgrade
An unhandled exception has been thrown:
TypeError: OCA\Theming\ImageManager::__construct(): Argument #5 ($logger) must be of type Psr\Log\LoggerInterface, OC\Log given, called in /usr/local/www/nextcloud/lib/private/Server.php on line 1237 and defined in /usr/local/www/nextcloud/apps-pkg/theming/lib/ImageManager.php:52
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Server.php(1237): OCA\Theming\ImageManager->__construct(Object(OC\AllConfig), Object(OC\Files\AppData\AppData), Object(OC\URLGenerator), Object(OC\Memcache\Factory), Object(OC\Log), Object(OC\TempManager))
#1 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\Server->OC\{closure}(Object(OC\Server))
#2 /usr/local/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#3 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet('ThemingDefaults')
#4 /usr/local/www/nextcloud/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query('ThemingDefaults', true)
#5 /usr/local/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query('ThemingDefaults')
#6 /usr/local/www/nextcloud/lib/private/Server.php(2175): OC\AppFramework\Utility\SimpleContainer->get('ThemingDefaults')
#7 /usr/local/www/nextcloud/lib/private/Console/Application.php(67): OC\Server->getThemingDefaults()
#8 /usr/local/www/nextcloud/console.php(97): OC\Console\Application->__construct(Object(OC\AllConfig), Object(OC\EventDispatcher\SymfonyAdapter), Object(OC\AppFramework\Http\Request), Object(OC\Log\PsrLoggerAdapter), Object(OC\MemoryInfo))
#9 /usr/local/www/nextcloud/occ(11): require_once('/usr/local/www/...')

I had to copy the apps-pkg directory from the production folder as my config.php file requires it.

Right so having some luck here…

I managed to upgrade my way up to 28.0.9

I can’t go beyond though as the updater just kicks up the same error about ‘skipping major versions’

  - installed: true
  - version: 28.0.9.1
  - versionstring: 28.0.9
  - edition: 
  - maintenance: false
  - needsDbUpgrade: false
  - productname: Nextcloud
  - extendedSupport: false

Reading around and I did find a forum posting about this however, the versions were so old the thread got closed

If I run the occ upgrade command I get:

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
Exception: Updates between multiple major versions and downgrades are unsupported.
Update failed
Maintenance mode is kept active
Resetting log level

I find this resource summarizes the process to get back on track pretty good:

Thanks for the response.

The thing is that I have managed to get to the next inline release which is 28.0.9. There is no other version between 29 and that.

I attempted the steps in the posting and now the version.php file looks like this:

<?php 
$OC_Version = array(28,0,9,1);
$OC_VersionString = '28.0.9';
$OC_Edition = '';
$OC_Channel = 'stable';
$OC_VersionCanBeUpgradedFrom = array (
  'nextcloud' => 
  array (
    '28.0' => true,
    '29.0' => true,
  ),
  'owncloud' => 
  array (
    '10.13' => true,
  ),
);
$OC_Build = '2024-08-20T17:59:52+00:00 5b8bbd375fefce3e9fb9564abcc395706bd1a622';
$vendor = 'nextcloud';

Unfortunately the same error is being thrown:

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
Setting log level to debug
Exception: Updates between multiple major versions and downgrades are unsupported.
Update failed
Maintenance mode is kept active
Resetting log level

I wonder if there is a way to either log or see the output of the: occ upgrade command??

I did check the nextlcoud.log file but it isn’t coming up with anything usable for me.

Is there anything that can be done or that I can try to get my NC instance upgraded?

Like I mentioned it would really help if the ‘occ upgrade’ command would log information or using the -vvv switch would provide a sequence of what was going on.

I even tried setting debug mode to on but it didn’t seem to do anything.

Any ideas would be great right now…

I’m not using Docker so anything related to that won’t exactly work, it’s more an issue with my NC instance I think as I’ve been upgrading from many previous versions. But then why could I get on to version 28.0.9 pulling the code from here then extracting into my web server:
https://nextcloud.com/changelog/#latest27

but then going to version 29.0.0 or 29.0.5 just doesn’t work at all???

Either I’m missing something or I don’t know… ??