Future note to self 🙂 and hopefully others can learn or fix any similar NextCloud upgrade issue/s I had.
LinuxServer do a great job – thankyou! Though this is a NC issue or my missing something, or doing something incorrectly during upgrade, or just one of those things that happens.
I’ve never had so many problems upgrading a NC version, logs weren’t giving me much help. I was getting corrupt database errors, upgrades (following all 3 install types on p-1 of this thread) wouldn’t take, etc. I’d install previous backups using the CA Backup/Restore app and work forward from there.
Even after reinstalling older NC and MariaDB versions from backups, NC was telling me it’s already on 20.0.4, though it was on 19.0.3 and just wouldn’t let me upgrade whatsoever. I inspected or purged the the NC updater folders, etc. NC just wouldn’t budge and kept giving me I’m already updated and occ command errors.
In the end, I kept all config files, backed up my NC files/folders, completely purged MariaDB and NC, then reinstalled them from scratch, made new databases, etc.
After a fresh install, I then upgraded to 20.0.4, then I ran the below OCC commands, then I manually added files/folders and everything works great now without any errors 🙂
# in a NC docker terminal window:-
sudo -u abc php /config/www/nextcloud/occ db:add-missing-indices
sudo -u abc php /config/www/nextcloud/occ db:add-missing-primary-keys
sudo -u abc php /config/www/nextcloud/occ db:convert-filecache-bigint
# ADD files/folders for my NextCloud UserName to the MariaDB database:-
# # IF in NC docker terminal/console window:
sudo -u abc php /config/www/nextcloud/occ files:scan UserName <-- Change UserName to username used in NextCloud
# # IF in an unRAID terminal window:-
docker exec -it nextcloud sudo -u abc /config/www/nextcloud/occ files:scan UN <-- UN = username used in NextCloud
** or:- sudo -u abc php /config/www/nextcloud/occ files:scan all to detect all new and changed files and folders.
# # Or setup as a User Script to automate file:scan to run periodically/daily/weekly, etc:-
#!/bin/bash
echo "<font color='red'><b>Adding unrecognised files to NextCloud user database</b></font>"
docker exec -it nextcloud sudo -u abc /config/www/nextcloud/occ files:scan UN <-- UN = associated username in NextCloud
echo ""
echo "<font color='red'>Done!!</b></font>"
Though the safest way is to upload files/folders through webdav. I personally use ‘ocsmount Pro’ webdav on Mac to do this and not use the NextCloud app at all.
# May also add this line in NC config.php - Just in case you forget to run 'file:scan' function. this makes files immediately visible when added from outside a NC environment; Eg; Using samba share in Finder or Windows Explorer to connect directly to NextCloud files.
# # Add following line towards the end of NC config.php.
'filesystem_check_changes' => 1,
Then Docker restart nextcloud
Then I ran a fresh instance appdata backup
I hope this helps someone 🙂