Apps error after database migration

Hi All,

I did a NextcloudPi data migration from one server to another.

Old server:
Nextcloud version: 23.0.12 - NextCloudPi v1.50.3
Operating system and version: Raspbian GNU/Linux 10 (buster)
Apache or nginx version: Apache
PHP version: PHP 7.3

New Server:
Nextcloud version: 28.0.5 - NextcloudPi_RaspberryPi5_v1.54.0
Operating system and version: Raspberry Pi OS/Debian 11 (Bullseye)
Apache or nginx version (eg, Apache 2.4.25): Apache
PHP version: PHP 8.1

For the Database migration I first dropped the database and then recreated it as it is described in the nextcloud docu.
Then I restored the database from the db dump from the old server.

When now accessing Nextcloud on the new server and try to install or update some apps (e.g. Polls-app) I am getting an error message (full error message below):

"Cannot assign null to property OCA\\Polls\\Db\\EntityWithUser::$anonymized of type int in file '/var/www/nextcloud/lib/public/AppFramework/Db/Entity.php'..."

Does anyone know how to fix this?
Thank you very much in advance
Cheers

Full error message from nextcloud.log:

{"reqId":"Zmtmh1XpEU3MWkb8YN30sgAAVRg","level":1,"time":"2024-06-13T21:37:16+00:00","remoteAddr":"x.x.x.x","user":"X","app":"polls","method":"POST","url":"/settings/apps/enable","message":"Updated 74 hashes in oc_polls_options","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0","version":"28.0.5.1","data":{"app":"polls"}}
{"reqId":"Zmtmh1XpEU3MWkb8YN30sgAAVRg","level":3,"time":"2024-06-13T21:37:16+00:00","remoteAddr":"1x.x.x.x","user":"ncp","app":"index","method":"POST","url":"/settings/apps/enable","message":"Cannot assign null to property OCA\\Polls\\Db\\EntityWithUser::$anonymized of type int in file '/var/www/nextcloud/lib/public/AppFramework/Db/Entity.php' line 136","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0","version":"28.0.5.1","exception"
:{"Exception":"Exception","Message":"Cannot assign null to property OCA\\Polls\\Db\\EntityWithUser::$anonymized of type int in file '/var/www/nextcloud/lib/public/AppFramework/Db/Entity.php' line 136","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line"
:39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"TypeError","Message":"Cannot assign null to property OCA\\Polls\\Db\\EntityWithUser::$anonymized of type int","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/public/AppFramework/Db/Entity.php","line":167,"function":"setter","class":"OCP\\AppFramework\\Db\\Entity","type":"->"},{"file":"/var/www/nextcloud/lib/public/AppFramework/Db/Entity.php","line":75,"function":"__call","class":"OCP\\AppFramework\\Db\\Entity","type":"->"},{"file":"/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php","line":321,"function":"fromRow","class":"OCP\\AppFramework\\Db\\Entity","type":"::"},{"file":"/var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php","line":361,"function":"mapRowToEntity","class":"OCP\\AppFramework\\Db\\QBMapper","type":"->"},{"file":"/var/www/nextcloud/apps/polls/lib/Db/VoteMapper.php","line":155,"function":"findEntity","class":"OCP\\AppFramework\\Db\\QBMapper","type":"->"},{"file":"/var/www/nextcloud/apps/polls/lib/Db/VoteMapper.php","line":36,"function":"find","class":"OCA\\Polls\\Db\\VoteMapper","type":"->"},{"file":"/var/www/nextcloud/apps/polls/lib/Db/TableManager.php","line":409,"function":"update","class":"OCA\\Polls\\Db\\VoteMapper","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/polls/lib/Migration/RepairSteps/UpdateHashes.php","line":34,"function":"migrateOptionsToHash","class":"OCA\\Polls\\Db\\TableManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/Repair.php","line":127,"function":"run","class":"OCA\\Polls\\Migration\\RepairSteps\\UpdateHashes","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":836,"function":"run","class":"OC\\Repair","type":"->"},{"file":"/var/www/nextcloud/lib/private/Installer.php","line":158,"function":"executeRepairSteps","class":"OC_App","type":"::"},{"file":"/var/www/nextcloud/apps/settings/lib/Controller/AppSettingsController.php","line":454,"function":"installApp","class":"OC\\Installer","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"enableApps","class":"OCA\\Settings\\Controller\\AppSettingsController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/public/AppFramework/Db/Entity.php","Line":136},"message":"Cannot assign null to property OCA\\Polls\\Db\\EntityWithUser::$anonymized of type int in file '/var/www/nextcloud/lib/public/AppFramework/Db/Entity.php' line 136","exception":{},"CustomMessage":"Cannot assign null to property OCA\\Polls\\Db\\EntityWithUser::$anonymized of type int in file '/var/www/nextcloud/lib/public/AppFramework/Db/Entity.php' line 136"}}

This approach is not supported, better take notice which ncp version serves which nc version.
NC does not support update more than one major number release at once.

1 Like

You cannot migrate between different versions of Nc. The database structures will not match.

You need to either upgrade Nc on the old server prior to migrating or install the same older version on the new target server (then upgrade it after you’ve migrated your data). A hybrid approach is also an option.

Thank you very much for your help.
Cheers

1 Like

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