解决下Nextcloud的数据库问题
把Nextcloud升级到了20.0.2 RC1,安全检查时显示missing some primary keys.
[redbar]关于您的设置有一些警告。
The database is missing some primary keys. Due to the fact that adding primary keys on big tables could take some time they were not added automatically. By running "occ db:add-missing-primary-keys" those missing primary keys could be added manually while the instance keeps running.
Missing primary key on table "oc_federated_reshares".
Missing primary key on table "oc_systemtag_object_mapping".
Missing primary key on table "oc_comments_read_markers".
Missing primary key on table "oc_collres_resources".
Missing primary key on table "oc_collres_accesscache".
Missing primary key on table "oc_filecache_extended".[/redbar]
打开Protainer,连到Nextcloud的bash,然后输入命令修复
[bluebar]sudo -u abc php /config/www/nextcloud/occ db:add-missing-primary-keys[/bluebar]
报错
没有定义这个命令,
去Github上看了下,是个BUG
[btnblue href="https://github.com/nextcloud/server/pull/24085" target="blank"]查看BUG详情[/btnblue]
解决方法就是手动修改一下命令把add-missing-primary-keys这个功能加上去
[btnblue href="https://github.com/nextcloud/server/pull/24106/commits/e0dbfdf575506d5bc2a7857a17d923b2a82a8d5f" target="blank"]查看修复详情[/btnblue]
加上去之后,再次执行命令,直接通过:
回到网盘重新执行安全检查,通过: