Skip to content

[Bug]: Migration from ownCloud not possible since NC31 #57340

@MichaIng

Description

@MichaIng

⚠️ This issue respects the following points: ⚠️

Bug description

Commit a572a5c (#51221) removed the pre-migration check to support the old appconfig table structure used in NC28 and older, including latest ownCloud 10.16. Hence, occ upgrade fails at the very start. #47658 caused a similar issue with the preferences table, causing errors on occ upgrade.

The docs state that migration is possible to NC25 only, due to dropped PHP 7.4 support. However, ownCloud does not need to be accessible via PHP to perform a migration, and the latest NC version.php declares support for migration from ownCloud 10.13 - 10.16. Since NC25 declares migration support only for ownCloud 10.13, it requires patching to do the migration as stated in the docs, where support up to ownCloud 10.15 is stated.

I am not sure whether docs are wrong or version.php is wrong, but the info is contradicting, and migration is currently impossible without manually patching Nextcloud files, either version.php on NC25 or reverting a572a5c on NC32 and above, and applying a similar condition for preferences queries for NC31 and above.

@ArtificialOwl was ownCloud migration an oversight in #47658 and #51221, or is NC31+ not supposed to support the ownCloud database migration anymore?

Adding the type column actually seems like a simple workaround. An empty value is gracefully handled as 0 it seems.

Same for the lazy columns:

An unhandled exception has been thrown:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'lazy' in 'WHERE' in /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:130
Stack trace:
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php(130): PDOStatement->execute()
#1 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1104): Doctrine\DBAL\Driver\PDO\Statement->execute()
#2 /var/www/nextcloud/lib/private/DB/Connection.php(420): Doctrine\DBAL\Connection->executeQuery()
#3 /var/www/nextcloud/lib/private/DB/ConnectionAdapter.php(50): OC\DB\Connection->executeQuery()
#4 /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(291): OC\DB\ConnectionAdapter->executeQuery()
#5 /var/www/nextcloud/lib/private/AppConfig.php(1360): OC\DB\QueryBuilder\QueryBuilder->executeQuery()
#6 /var/www/nextcloud/lib/private/AppConfig.php(284): OC\AppConfig->loadConfig()
#7 /var/www/nextcloud/lib/private/AppConfig.php(1832): OC\AppConfig->searchValues()
#8 /var/www/nextcloud/lib/private/Memcache/Factory.php(121): OC\AppConfig->getAppInstalledVersions()
#9 /var/www/nextcloud/lib/private/Memcache/Factory.php(160): OC\Memcache\Factory->getGlobalPrefix()
#10 /var/www/nextcloud/lib/private/Server.php(935): OC\Memcache\Factory->createLocking()
#11 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(169): OC\Server->OC\{closure}()
#12 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#13 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(136): Pimple\Container->offsetGet()
#14 /var/www/nextcloud/lib/private/ServerContainer.php(154): OC\AppFramework\Utility\SimpleContainer->query()
#15 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(45): OC\ServerContainer->query()
#16 /var/www/nextcloud/lib/private/Files/View.php(76): OC\AppFramework\Utility\SimpleContainer->get()
#17 /var/www/nextcloud/lib/private/Server.php(422): OC\Files\View->__construct()
#18 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(169): OC\Server->OC\{closure}()
#19 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#20 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(136): Pimple\Container->offsetGet()
#21 /var/www/nextcloud/lib/private/ServerContainer.php(154): OC\AppFramework\Utility\SimpleContainer->query()
#22 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(45): OC\ServerContainer->query()
#23 /var/www/nextcloud/lib/private/Server.php(1271): OC\AppFramework\Utility\SimpleContainer->get()
#24 /var/www/nextcloud/lib/base.php(635): OC\Server->boot()
#25 /var/www/nextcloud/lib/base.php(1192): OC::init()
#26 /var/www/nextcloud/console.php(31): require_once('...')
#27 /var/www/nextcloud/occ(33): require_once('...')
#28 {main}

Just tested, and this seems to work as a workaround:

mysql -e 'ALTER TABLE nextcloud.oc_appconfig ADD type INT UNSIGNED NOT NULL DEFAULT 2;'
mysql -e 'ALTER TABLE nextcloud.oc_appconfig ADD lazy SMALLINT UNSIGNED NOT NULL DEFAULT 0;'

occ upgrade throws an error before the database migration about another missing type column, but the upgrade goes through:

# occ upgrade
Setting log level to debug
Repair error: An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'type' in 'SELECT'
Updating database schema
Updated database
Disabled incompatible app: configreport
Disabled incompatible app: contacts
Disabled incompatible app: files_mediaviewer
Disabled incompatible app: market
Updating <federation> ...
Updated <federation> to 1.22.0
Updating <dav> ...
...

Relevant are these two migration steps:

occ fails without the two columns, but they need to be defined with correct data type and default for the migration steps to go through.

Inspecting the logs for the thrown error:

Details
{
  "reqId": "1Q2koZETE27ujklcCqe1",
  "level": 3,
  "time": "2026-01-05T11:18:25+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "no app in context",
  "method": "",
  "url": "--",
  "message": "Exception while executing repair step Copy data from accounts table when migrating from ownCloud",
  "userAgent": "--",
  "version": "10.16.0.0",
  "exception": {
    "Exception": "OC\\DB\\Exceptions\\DbalException",
    "Message": "An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'type' in 'SELECT'",
    "Code": 1054,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php",
        "line": 53,
        "function": "wrap",
        "class": "OC\\DB\\Exceptions\\DbalException",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
        "line": 291,
        "function": "executeQuery",
        "class": "OC\\DB\\ConnectionAdapter",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Config/UserConfig.php",
        "line": 1766,
        "function": "executeQuery",
        "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Config/UserConfig.php",
        "line": 1104,
        "function": "loadConfig",
        "class": "OC\\Config\\UserConfig",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Config/UserConfig.php",
        "line": 876,
        "function": "setTypedValue",
        "class": "OC\\Config\\UserConfig",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AllConfig.php",
        "line": 257,
        "function": "setValueMixed",
        "class": "OC\\Config\\UserConfig",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Repair/Owncloud/SaveAccountsTableData.php",
        "line": 167,
        "function": "setUserValue",
        "class": "OC\\AllConfig",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Repair/Owncloud/SaveAccountsTableData.php",
        "line": 134,
        "function": "migrateUserInfo",
        "class": "OC\\Repair\\Owncloud\\SaveAccountsTableData",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Repair/Owncloud/SaveAccountsTableData.php",
        "line": 56,
        "function": "runStep",
        "class": "OC\\Repair\\Owncloud\\SaveAccountsTableData",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Repair.php",
        "line": 107,
        "function": "run",
        "class": "OC\\Repair\\Owncloud\\SaveAccountsTableData",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Updater.php",
        "line": 223,
        "function": "run",
        "class": "OC\\Repair",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Updater.php",
        "line": 100,
        "function": "doUpgrade",
        "class": "OC\\Updater",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/core/Command/Upgrade.php",
        "line": 193,
        "function": "upgrade",
        "class": "OC\\Updater",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php",
        "line": 326,
        "function": "execute",
        "class": "OC\\Core\\Command\\Upgrade",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
        "line": 1078,
        "function": "run",
        "class": "Symfony\\Component\\Console\\Command\\Command",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
        "line": 324,
        "function": "doRunCommand",
        "class": "Symfony\\Component\\Console\\Application",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
        "line": 175,
        "function": "doRun",
        "class": "Symfony\\Component\\Console\\Application",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Console/Application.php",
        "line": 187,
        "function": "run",
        "class": "Symfony\\Component\\Console\\Application",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/console.php",
        "line": 90,
        "function": "run",
        "class": "OC\\Console\\Application",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/occ",
        "line": 33,
        "args": [
          "/var/www/nextcloud/console.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/DB/Exceptions/DbalException.php",
    "Line": 56,
    "Previous": {
      "Exception": "Doctrine\\DBAL\\Exception\\InvalidFieldNameException",
      "Message": "An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'type' in 'SELECT'",
      "Code": 1054,
      "Trace": [
        {
          "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
          "line": 1976,
          "function": "convert",
          "class": "Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
          "line": 1918,
          "function": "handleDriverException",
          "class": "Doctrine\\DBAL\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
          "line": 1111,
          "function": "convertExceptionDuringQuery",
          "class": "Doctrine\\DBAL\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/DB/Connection.php",
          "line": 420,
          "function": "executeQuery",
          "class": "Doctrine\\DBAL\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php",
          "line": 50,
          "function": "executeQuery",
          "class": "OC\\DB\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
          "line": 291,
          "function": "executeQuery",
          "class": "OC\\DB\\ConnectionAdapter",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Config/UserConfig.php",
          "line": 1766,
          "function": "executeQuery",
          "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Config/UserConfig.php",
          "line": 1104,
          "function": "loadConfig",
          "class": "OC\\Config\\UserConfig",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Config/UserConfig.php",
          "line": 876,
          "function": "setTypedValue",
          "class": "OC\\Config\\UserConfig",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AllConfig.php",
          "line": 257,
          "function": "setValueMixed",
          "class": "OC\\Config\\UserConfig",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Repair/Owncloud/SaveAccountsTableData.php",
          "line": 167,
          "function": "setUserValue",
          "class": "OC\\AllConfig",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Repair/Owncloud/SaveAccountsTableData.php",
          "line": 134,
          "function": "migrateUserInfo",
          "class": "OC\\Repair\\Owncloud\\SaveAccountsTableData",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Repair/Owncloud/SaveAccountsTableData.php",
          "line": 56,
          "function": "runStep",
          "class": "OC\\Repair\\Owncloud\\SaveAccountsTableData",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Repair.php",
          "line": 107,
          "function": "run",
          "class": "OC\\Repair\\Owncloud\\SaveAccountsTableData",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Updater.php",
          "line": 223,
          "function": "run",
          "class": "OC\\Repair",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Updater.php",
          "line": 100,
          "function": "doUpgrade",
          "class": "OC\\Updater",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/core/Command/Upgrade.php",
          "line": 193,
          "function": "upgrade",
          "class": "OC\\Updater",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php",
          "line": 326,
          "function": "execute",
          "class": "OC\\Core\\Command\\Upgrade",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
          "line": 1078,
          "function": "run",
          "class": "Symfony\\Component\\Console\\Command\\Command",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
          "line": 324,
          "function": "doRunCommand",
          "class": "Symfony\\Component\\Console\\Application",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
          "line": 175,
          "function": "doRun",
          "class": "Symfony\\Component\\Console\\Application",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Console/Application.php",
          "line": 187,
          "function": "run",
          "class": "Symfony\\Component\\Console\\Application",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/console.php",
          "line": 90,
          "function": "run",
          "class": "OC\\Console\\Application",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/occ",
          "line": 33,
          "args": [
            "/var/www/nextcloud/console.php"
          ],
          "function": "require_once"
        }
      ],
      "File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php",
      "Line": 69,
      "Previous": {
        "Exception": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
        "Message": "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'type' in 'SELECT'",
        "Code": 1054,
        "Trace": [
          {
            "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
            "line": 132,
            "function": "new",
            "class": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
            "type": "::"
          },
          {
            "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
            "line": 1104,
            "function": "execute",
            "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/DB/Connection.php",
            "line": 420,
            "function": "executeQuery",
            "class": "Doctrine\\DBAL\\Connection",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php",
            "line": 50,
            "function": "executeQuery",
            "class": "OC\\DB\\Connection",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
            "line": 291,
            "function": "executeQuery",
            "class": "OC\\DB\\ConnectionAdapter",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/Config/UserConfig.php",
            "line": 1766,
            "function": "executeQuery",
            "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/Config/UserConfig.php",
            "line": 1104,
            "function": "loadConfig",
            "class": "OC\\Config\\UserConfig",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/Config/UserConfig.php",
            "line": 876,
            "function": "setTypedValue",
            "class": "OC\\Config\\UserConfig",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/AllConfig.php",
            "line": 257,
            "function": "setValueMixed",
            "class": "OC\\Config\\UserConfig",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/Repair/Owncloud/SaveAccountsTableData.php",
            "line": 167,
            "function": "setUserValue",
            "class": "OC\\AllConfig",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/Repair/Owncloud/SaveAccountsTableData.php",
            "line": 134,
            "function": "migrateUserInfo",
            "class": "OC\\Repair\\Owncloud\\SaveAccountsTableData",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/Repair/Owncloud/SaveAccountsTableData.php",
            "line": 56,
            "function": "runStep",
            "class": "OC\\Repair\\Owncloud\\SaveAccountsTableData",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/Repair.php",
            "line": 107,
            "function": "run",
            "class": "OC\\Repair\\Owncloud\\SaveAccountsTableData",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/Updater.php",
            "line": 223,
            "function": "run",
            "class": "OC\\Repair",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/Updater.php",
            "line": 100,
            "function": "doUpgrade",
            "class": "OC\\Updater",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/core/Command/Upgrade.php",
            "line": 193,
            "function": "upgrade",
            "class": "OC\\Updater",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php",
            "line": 326,
            "function": "execute",
            "class": "OC\\Core\\Command\\Upgrade",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
            "line": 1078,
            "function": "run",
            "class": "Symfony\\Component\\Console\\Command\\Command",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
            "line": 324,
            "function": "doRunCommand",
            "class": "Symfony\\Component\\Console\\Application",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
            "line": 175,
            "function": "doRun",
            "class": "Symfony\\Component\\Console\\Application",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/Console/Application.php",
            "line": 187,
            "function": "run",
            "class": "Symfony\\Component\\Console\\Application",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/console.php",
            "line": 90,
            "function": "run",
            "class": "OC\\Console\\Application",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/occ",
            "line": 33,
            "args": [
              "/var/www/nextcloud/console.php"
            ],
            "function": "require_once"
          }
        ],
        "File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php",
        "Line": 24,
        "Previous": {
          "Exception": "PDOException",
          "Message": "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'type' in 'SELECT'",
          "Code": "42S22",
          "Trace": [
            {
              "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
              "line": 130,
              "function": "execute",
              "class": "PDOStatement",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
              "line": 1104,
              "function": "execute",
              "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/DB/Connection.php",
              "line": 420,
              "function": "executeQuery",
              "class": "Doctrine\\DBAL\\Connection",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php",
              "line": 50,
              "function": "executeQuery",
              "class": "OC\\DB\\Connection",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
              "line": 291,
              "function": "executeQuery",
              "class": "OC\\DB\\ConnectionAdapter",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/Config/UserConfig.php",
              "line": 1766,
              "function": "executeQuery",
              "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/Config/UserConfig.php",
              "line": 1104,
              "function": "loadConfig",
              "class": "OC\\Config\\UserConfig",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/Config/UserConfig.php",
              "line": 876,
              "function": "setTypedValue",
              "class": "OC\\Config\\UserConfig",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/AllConfig.php",
              "line": 257,
              "function": "setValueMixed",
              "class": "OC\\Config\\UserConfig",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/Repair/Owncloud/SaveAccountsTableData.php",
              "line": 167,
              "function": "setUserValue",
              "class": "OC\\AllConfig",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/Repair/Owncloud/SaveAccountsTableData.php",
              "line": 134,
              "function": "migrateUserInfo",
              "class": "OC\\Repair\\Owncloud\\SaveAccountsTableData",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/Repair/Owncloud/SaveAccountsTableData.php",
              "line": 56,
              "function": "runStep",
              "class": "OC\\Repair\\Owncloud\\SaveAccountsTableData",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/Repair.php",
              "line": 107,
              "function": "run",
              "class": "OC\\Repair\\Owncloud\\SaveAccountsTableData",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/Updater.php",
              "line": 223,
              "function": "run",
              "class": "OC\\Repair",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/Updater.php",
              "line": 100,
              "function": "doUpgrade",
              "class": "OC\\Updater",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/core/Command/Upgrade.php",
              "line": 193,
              "function": "upgrade",
              "class": "OC\\Updater",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php",
              "line": 326,
              "function": "execute",
              "class": "OC\\Core\\Command\\Upgrade",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
              "line": 1078,
              "function": "run",
              "class": "Symfony\\Component\\Console\\Command\\Command",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
              "line": 324,
              "function": "doRunCommand",
              "class": "Symfony\\Component\\Console\\Application",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
              "line": 175,
              "function": "doRun",
              "class": "Symfony\\Component\\Console\\Application",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/Console/Application.php",
              "line": 187,
              "function": "run",
              "class": "Symfony\\Component\\Console\\Application",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/console.php",
              "line": 90,
              "function": "run",
              "class": "OC\\Console\\Application",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/occ",
              "line": 33,
              "args": [
                "/var/www/nextcloud/console.php"
              ],
              "function": "require_once"
            }
          ],
          "File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
          "Line": 130
        }
      }
    },
    "message": "Exception while executing repair step Copy data from accounts table when migrating from ownCloud",
    "exception": {
      "query": "SELECT `appid`, `configkey`, `configvalue`, `type`, `flags` FROM `*PREFIX*preferences` WHERE (`userid` = :dcValue1) AND (`lazy` = :dcValue2)"
    },
    "CustomMessage": "Exception while executing repair step Copy data from accounts table when migrating from ownCloud"
  }
}
Not sure whether that one is related, but indeed Nextcloud 32 fails to open the dashboard after the ownCloud migration:
Details
{
  "reqId": "UQyG9flsJMHN6K9xoei3",
  "level": 3,
  "time": "2026-01-05T11:57:21+00:00",
  "remoteAddr": "192.168.1.34",
  "user": "admin",
  "app": "index",
  "method": "GET",
  "url": "/nextcloud/apps/dashboard/",
  "message": "An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'data' in 'SELECT'",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 OPR/125.0.0.0",
  "version": "32.0.3.2",
  "exception": {
    "Exception": "OC\\DB\\Exceptions\\DbalException",
    "Message": "An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'data' in 'SELECT'",
    "Code": 1054,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php",
        "line": 53,
        "function": "wrap",
        "class": "OC\\DB\\Exceptions\\DbalException",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
        "line": 291,
        "function": "executeQuery",
        "class": "OC\\DB\\ConnectionAdapter",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Accounts/AccountManager.php",
        "line": 199,
        "function": "executeQuery",
        "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Accounts/AccountManager.php",
        "line": 663,
        "function": "getUser",
        "class": "OC\\Accounts\\AccountManager",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/dashboard/lib/Service/DashboardService.php",
        "line": 61,
        "function": "getAccount",
        "class": "OC\\Accounts\\AccountManager",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/dashboard/lib/Controller/DashboardController.php",
        "line": 71,
        "function": "getBirthdate",
        "class": "OCA\\Dashboard\\Service\\DashboardService",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 204,
        "function": "index",
        "class": "OCA\\Dashboard\\Controller\\DashboardController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 118,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 153,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 321,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1061,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 25,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/DB/Exceptions/DbalException.php",
    "Line": 56,
    "Previous": {
      "Exception": "Doctrine\\DBAL\\Exception\\InvalidFieldNameException",
      "Message": "An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'data' in 'SELECT'",
      "Code": 1054,
      "Trace": [
        {
          "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
          "line": 1976,
          "function": "convert",
          "class": "Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
          "line": 1918,
          "function": "handleDriverException",
          "class": "Doctrine\\DBAL\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
          "line": 1111,
          "function": "convertExceptionDuringQuery",
          "class": "Doctrine\\DBAL\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/DB/Connection.php",
          "line": 420,
          "function": "executeQuery",
          "class": "Doctrine\\DBAL\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php",
          "line": 50,
          "function": "executeQuery",
          "class": "OC\\DB\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
          "line": 291,
          "function": "executeQuery",
          "class": "OC\\DB\\ConnectionAdapter",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Accounts/AccountManager.php",
          "line": 199,
          "function": "executeQuery",
          "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Accounts/AccountManager.php",
          "line": 663,
          "function": "getUser",
          "class": "OC\\Accounts\\AccountManager",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/dashboard/lib/Service/DashboardService.php",
          "line": 61,
          "function": "getAccount",
          "class": "OC\\Accounts\\AccountManager",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/apps/dashboard/lib/Controller/DashboardController.php",
          "line": 71,
          "function": "getBirthdate",
          "class": "OCA\\Dashboard\\Service\\DashboardService",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 204,
          "function": "index",
          "class": "OCA\\Dashboard\\Controller\\DashboardController",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 118,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
          "line": 153,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Route/Router.php",
          "line": 321,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/nextcloud/lib/base.php",
          "line": 1061,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/index.php",
          "line": 25,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php",
      "Line": 69,
      "Previous": {
        "Exception": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
        "Message": "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'data' in 'SELECT'",
        "Code": 1054,
        "Trace": [
          {
            "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
            "line": 132,
            "function": "new",
            "class": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
            "type": "::"
          },
          {
            "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
            "line": 1104,
            "function": "execute",
            "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/DB/Connection.php",
            "line": 420,
            "function": "executeQuery",
            "class": "Doctrine\\DBAL\\Connection",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php",
            "line": 50,
            "function": "executeQuery",
            "class": "OC\\DB\\Connection",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
            "line": 291,
            "function": "executeQuery",
            "class": "OC\\DB\\ConnectionAdapter",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/Accounts/AccountManager.php",
            "line": 199,
            "function": "executeQuery",
            "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/Accounts/AccountManager.php",
            "line": 663,
            "function": "getUser",
            "class": "OC\\Accounts\\AccountManager",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/apps/dashboard/lib/Service/DashboardService.php",
            "line": 61,
            "function": "getAccount",
            "class": "OC\\Accounts\\AccountManager",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/apps/dashboard/lib/Controller/DashboardController.php",
            "line": 71,
            "function": "getBirthdate",
            "class": "OCA\\Dashboard\\Service\\DashboardService",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
            "line": 204,
            "function": "index",
            "class": "OCA\\Dashboard\\Controller\\DashboardController",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
            "line": 118,
            "function": "executeController",
            "class": "OC\\AppFramework\\Http\\Dispatcher",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
            "line": 153,
            "function": "dispatch",
            "class": "OC\\AppFramework\\Http\\Dispatcher",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/lib/private/Route/Router.php",
            "line": 321,
            "function": "main",
            "class": "OC\\AppFramework\\App",
            "type": "::"
          },
          {
            "file": "/var/www/nextcloud/lib/base.php",
            "line": 1061,
            "function": "match",
            "class": "OC\\Route\\Router",
            "type": "->"
          },
          {
            "file": "/var/www/nextcloud/index.php",
            "line": 25,
            "function": "handleRequest",
            "class": "OC",
            "type": "::"
          }
        ],
        "File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php",
        "Line": 24,
        "Previous": {
          "Exception": "PDOException",
          "Message": "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'data' in 'SELECT'",
          "Code": "42S22",
          "Trace": [
            {
              "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
              "line": 130,
              "function": "execute",
              "class": "PDOStatement",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php",
              "line": 1104,
              "function": "execute",
              "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/DB/Connection.php",
              "line": 420,
              "function": "executeQuery",
              "class": "Doctrine\\DBAL\\Connection",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php",
              "line": 50,
              "function": "executeQuery",
              "class": "OC\\DB\\Connection",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php",
              "line": 291,
              "function": "executeQuery",
              "class": "OC\\DB\\ConnectionAdapter",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/Accounts/AccountManager.php",
              "line": 199,
              "function": "executeQuery",
              "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/Accounts/AccountManager.php",
              "line": 663,
              "function": "getUser",
              "class": "OC\\Accounts\\AccountManager",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/apps/dashboard/lib/Service/DashboardService.php",
              "line": 61,
              "function": "getAccount",
              "class": "OC\\Accounts\\AccountManager",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/apps/dashboard/lib/Controller/DashboardController.php",
              "line": 71,
              "function": "getBirthdate",
              "class": "OCA\\Dashboard\\Service\\DashboardService",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
              "line": 204,
              "function": "index",
              "class": "OCA\\Dashboard\\Controller\\DashboardController",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
              "line": 118,
              "function": "executeController",
              "class": "OC\\AppFramework\\Http\\Dispatcher",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
              "line": 153,
              "function": "dispatch",
              "class": "OC\\AppFramework\\Http\\Dispatcher",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/lib/private/Route/Router.php",
              "line": 321,
              "function": "main",
              "class": "OC\\AppFramework\\App",
              "type": "::"
            },
            {
              "file": "/var/www/nextcloud/lib/base.php",
              "line": 1061,
              "function": "match",
              "class": "OC\\Route\\Router",
              "type": "->"
            },
            {
              "file": "/var/www/nextcloud/index.php",
              "line": 25,
              "function": "handleRequest",
              "class": "OC",
              "type": "::"
            }
          ],
          "File": "/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
          "Line": 130
        }
      }
    },
    "message": "An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'data' in 'SELECT'",
    "exception": {
      "query": "SELECT `data` FROM `*PREFIX*accounts` WHERE `uid` = :uid"
    },
    "CustomMessage": "An exception occurred while executing a query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'data' in 'SELECT'"
  }
}

First about the (ignored) error thrown by the upgrade:

EDIT: Okay, when running into the above error with missing oc_preferences tables once, the oc_accounts table seems to be lost. I was able to replicate it two times. This causes the missing data column error. Absolutely room to analyze what is happening exactly and hardining those steps, as such data loss while occ upgrade does not even abort is problematic. However, with the following steps on a fresh ownCloud 10.16 database it can be avoided:

mysql -e 'ALTER TABLE nextcloud.oc_appconfig ADD type INT UNSIGNED NOT NULL DEFAULT 2;'
mysql -e 'ALTER TABLE nextcloud.oc_appconfig ADD lazy SMALLINT UNSIGNED NOT NULL DEFAULT 0;'
mysql -e 'ALTER TABLE nextcloud.oc_preferences ADD lazy SMALLINT UNSIGNED NOT NULL DEFAULT 0;'
mysql -e 'ALTER TABLE nextcloud.oc_preferences ADD type SMALLINT UNSIGNED NOT NULL DEFAULT 0;'
mysql -e 'ALTER TABLE nextcloud.oc_preferences ADD flags INT UNSIGNED NOT NULL DEFAULT 0;'
mysql -e 'ALTER TABLE nextcloud.oc_preferences ADD indexed VARCHAR(64);'
occ upgrade # will fail
mysql -e 'ALTER TABLE nextcloud.oc_preferences DROP COLUMN lazy, DROP COLUMN type, DROP COLUMN flags, DROP COLUMN indexed;'
occ upgrade # will succeed without error
  • Creating the oc_appconfig columns is strictly needed for occ to run at all. It does not cause issues when creating them with correct types and defaults, the type migration is skipped, the lazy column is removed first, and re-added in the very next migration.
  • The oc_preferences columns are needed to prevent oc_accounts from somehow being removed. But it causes the related migration steps (later upgrade step) to fail, hence they need to be removed again.
  • When occ upgrade passed the first migration steps once, the missing oc_preferences columns do not throw errors and do not cause the oc_accounts table being removed.
  • The 2nd occ upgrade hence succeeds.

Now it would be interesting to know whether this migration is still supposed to work seamlessly. If so, one commit needs to be reverted, and the oc_preferences things needs to be investigated. Else, some major cleanup of old migration steps and version.php and all around ownCloud migration could be done.

Next question is whether ownCloud 10.14+ => Nextcloud 25 shall be possible. If so, that branch needs version.php to be updated. Otherwise, the docs need to be updated to make clear that migration is possible only from ownCloud 10.13, which does not make too much sense to keep at all, i.e. the migration page could then be just removed from the docs, making clear that there is not migration possible anymore without manual hacks.

Steps to reproduce

Follow https://docs.nextcloud.com/server/latest/admin_manual/maintenance/migrating_owncloud.html either with NC25 or with NC32.

Expected behavior

ownCloud => Nextcloud migration should be possible either as documented from up to 10.15 to NC25 or, better, from any ownCloud to latest NC32.

If latest NC is not supposed to support ownCloud migration, it should be removed from version.php.

Nextcloud Server version

32

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions