Help error in MariaDB or NextCloud

Hi guys, , I have a nextcloud here and it is reporting these two errors:
Index missing “calendarobject_calid_index” on table “oc_calendarobjects_props”.
Index missing “schedulobj_principuri_index” on table “oc_schedulingobjects”.
How could I add these missing indexes to these tables? For error in security
to vanish

You can e.g. use phpmyadmin or the mysql command line tool to add the missing index. Aunt G. will tell you the exact syntax if necessary. This is how the mentioned table should look like afterwards:

MariaDB [nextcloud]> describe oc_calendarobjects_props;
| Field        | Type                | Null | Key | Default | Extra          |
| id           | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| calendarid   | bigint(20)          | NO   | MUL | 0       |                |
| objectid     | bigint(20) unsigned | NO   | MUL | 0       |                |
| name         | varchar(64)         | YES  | MUL | NULL    |                |
| parameter    | varchar(64)         | YES  |     | NULL    |                |
| value        | varchar(255)        | YES  | MUL | NULL    |                |
| calendartype | int(11)             | NO   |     | 0       |                |

You can add missing indices with the following command. Run it from the Nextcloud folder.

./occ db:add-missing-indices


You should by no mean mess manually with the database structure, Nextcloud has appropiate tooling for this.
Use the method @AlfredSK mentioned. If you don’t have access to a command line, use the occ-web app.

when you run the command, you get this message, you are using the root user, in the / var / www / html folder

bash: ./occ: Permission denied

add the execute permission (chmod u+x occ) or try php occ db:add-missing-indices

root@cloud:/var/www/html# sudo -u www-data ./occ db:add-missing-indices
Check indices of the share table.
Check indices of the filecache table.
Check indices of the twofactor_providers table.
Check indices of the login_flow_v2 table.
Check indices of the whats_new table.
Check indices of the cards table.
Check indices of the cards_properties table.
Check indices of the calendarobjects_props table.
Adding calendarobject_calid_index index to the calendarobjects_props table, this can take some time…
calendarobjects_props table updated successfully.
Check indices of the schedulingobjects table.
Adding schedulobj_principuri_index index to the schedulingobjects table, this can take some time…
schedulingobjects table updated successfully.

but now I can’t log in with any account in the nextcloud

I guess this is not related to adding the indices.

Anyway if you like to get help to sort this out you’ll need to provide additional information. Is there some sort of error message shown, any useful entries in nextcloud.log?

After I run this command I went to log in to the next cloud, type the username and password, it takes a few seconds and goes back to the login screen, I’ll see if I can find anything in the log files, but it seems that there are no more users , to execute your command I had to use this syntax.
chmod u + x occ and sudo -u www-data ./occ db: add-missing-indices, after that he no longer logged in.

OK, that’s okay, I was trying to access via http, when I put https apparently it was, but didn’t ask for login

Thank you all for your help. @anon99283430 @AlfredSK

1 Like

you know, i am sorry, but if we can just be a little bit less lazy and give a “complete” answer, this world would be a better place…especially for someone who is trying to learn Linux/NextCloud.

sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices


it got /usr/bin/env: ‘php’: no such file or directory
I’m using Traefik reverse proxy.