After upgrading an instance of NextCloudPi from version 13 to version 14, I received the following error notification:
In short, the table “oc_share” was missing the index “parent_index” and the table “oc_filecache” was missing the index “fs_mtime”.
I tried SSH-ing to my NextCloudPi server and running the suggested command, “occ db:add-missing-indices” but it generated an error.
Despite the missing database entries, the instance still seemed to run fine, but I found the constant error message vexing.
After some online research and examination of my NextCloudPi instance’s directory structure, I found the following solution, and not seeing it posted elsewhere, thought I’d share it here:
1. SSH to your NextCloudPi instance.
2. Get a root prompt by entering:
3. Go up to the root directory by typing the following command twice (or as many times as necessary):
4. Switch to the nextcloud directory:
5. Run the following command:
sudo -u www-data php occ db:add-missing-indices
6. You should receive something like the following prompts (which I received):
Check indices of the share table. Adding additional parent index to the share table, this can take some time... Share table updated successfully. Adding additional mtime index to the filecache table, this can take some time... Filecache table updated successfully.
7. That’s all! Type “exit” and hit enter to terminate the SSH session. The error message should no longer appear.