After updating to nextcloud 16.0.0 you might get the following error:
Fehlender Index “version” in der Tabelle “oc_whats_new”.
Fehlender Index “twofactor_providers_uid” in der Tabelle “oc_twofactor_providers”.
Fehlender Index “cards_abid” in der Tabelle “oc_cards”.
Fehlender Index “cards_prop_abid” in der Tabelle “oc_cards_properties”.
To solve the problem above you can add the missing indices by using the following SQL queries on your MSSQL database:
ALTER TABLE `oc_whats_new` ADD KEY `version` (`version`) USING BTREE;
ALTER TABLE `oc_twofactor_providers` ADD KEY `twofactor_providers_uid` (`uid`) USING BTREE;
ALTER TABLE `oc_cards` ADD KEY `cards_abid` (`addressbookid`) USING BTREE;
ALTER TABLE `oc_cards_properties` ADD KEY `cards_prop_abid` (`addressbookid`) USING BTREE;
We should rather not make changes to the DB directly if there are other ways.
Maybe you remember the last time someone just copied SQL queries from the forum and messed up his database.
The better and more secure way (in my opinion)
Use the occ command, which performs the necessary DB changes quick and easy and most importantly: the exact way the devs intended it
The command: sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices
Alternative way
For everybody who has neither DB access, SSH access to his server nor sudo rights, please have a look at this app: https://apps.nextcloud.com/apps/occweb
If you are the NC admin and have SSH access but no rights to run occ commands, I would ask the server admin (/hoster) to grant you the rights to run the occ commands. They are very important for NC configuration and maintaining. Shouldn’t be a problem to get these permissions.
CREATE INDEX twofactor_providers_uid ON oc_twofactor_providers USING btree (uid);
CREATE INDEX version ON oc_whats_new USING btree (version);
CREATE INDEX cards_abid ON oc_cards USING btree (addressbookid);
CREATE INDEX cards_prop_abid ON oc_cards_properties USING btree (addressbookid);
Running the command
sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices
I got this error:
PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 32768 bytes) in /var/www/nextcloud/3rdparty/composer/autoload_static.php on line 2374
Could you please help me with this error?
Thank you in advance.
Sorry. I found my issue. In my php.ini file the memory_limit was set wrong. It was 1024MB instead of 1024M. Correcting this, I can now run 0cc commands.