Help with occ db:add-missing-indices

hi,

after nextcloud update 19.0.1 i have error: Missing index “properties_path_index” in table “oc_properties”.

If i sudo ae php occ db:add-missing-indices then i get error: PHP Parse error: syntax error, unexpected ‘class’ (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or ‘{’ or ‘$’ in /media/aecloud/nextcloud/console.php on line 97

PHP 7.3.0 (cli) (built: Aug 27 2020 10:29:21) ( NTS )
Copyright © 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright © 1998-2018 Zend Technologies
with the ionCube PHP Loader + ionCube24 v10.3.9, Copyright © 2002-2019, by ionCube Ltd.
with SourceGuardian v11.4.1, Copyright © 2000-2020, by SourceGuardian Ltd.

2 Likes

+1 same error here. Any solution?

Hi,
after nextcloud update 19.0.3 * The database is missing some indexes. Due to the fact that adding indexes on big tables could take some time they were not added automatically. By running “occ db:add-missing-indices” those missing indexes could be added manually while the instance keeps running. Once the indexes are added queries to those tables are usually much faster.

  • Missing index “properties_path_index” in table “oc_properties”.
  • The database is missing some optional columns. Due to the fact that adding columns on big tables could take some time they were not added automatically when they can be optional. By running “occ db:add-missing-columns” those missing columns could be added manually while the instance keeps running. Once the columns are added some features might improve responsiveness or usability.
    • Missing optional column “reference_id” in table “oc_comments”.

I Run this Command:

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

And every is Ok Now.

5 Likes

This also worked for me

Thanks, its the best solution for my problem :kissing_heart: :+1:
Nextcloud 19.0.4

In case you’re on shared hosting maybe the follow SQL statements will help you to fix the problem:

ALTER TABLE `oc_properties` ADD INDEX `properties_path_index` (`userid`, `propertypath`) USING BTREE;
ALTER TABLE `oc_comments` ADD `reference_id` VARCHAR(64) NULL DEFAULT NULL;
ALTER TABLE `oc_filecache_extended` MODIFY `fileid` BIGINT(20) UNSIGNED NOT NULL;
2 Likes

For Nextcloud on Unraid, I used this in a terminal window and it worked:

docker exec -it nextcloud occ db:add-missing-indices
docker exec -it nextcloud occ db:add-missing-columns

3 Likes

Much appreciated!