weixin_39731586
weixin_39731586
2021-01-07 07:12

Auto update indices on NextCloud update

After upgrading my NextCloud Docker from 13.0.6 to 14.0.0 the control panel was showing a warning that my database was missing indices.

Currently the README.md states that updating the NextCloud Docker is as easy as pulling the new image and recreating the container, and the upgrade process will start automatically. So I think there are 2 options:

  • Automatically add missing indices during the upgrade process (as I've done in this PR)
  • Add a note to the README.md that you may have to manually add missing indices after upgrading

If you're looking for a way to manually add missing indices, just run:

shell
docker exec -it --user www-data $CONTAINER_NAME bash
./occ db:add-missing-indices

该提问来源于开源项目:nextcloud/docker

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39730801 weixin_39730801 4月前

    Adding the missing indices is intentionally not done when running occ upgrade because this is a very slow operation if you have a large database. This step is also optional. It will improve the performance but is not required for nextcloud to run. Because of this it also doesn't make sense to tell users that is is required after each update.

    I think the warning in the admin page is enough. And it should also link the user to the docs, where the user can read how to add the indices.

    点赞 评论 复制链接分享
  • weixin_39734074 weixin_39734074 4月前

    I tried that, (and I assuming $CONTAINER_NAME is my 'app' one, and not the Maria one, yes?) and get:

    My running Containers are: ncinit_cron_1 ncinit_web_1 nicinit_app_1 nicinit_db_1 ncinit_redis_1

    
     docker exec -it --user www-data $ncinit_app_1 bash ./occ db:add-missing-indices
    ./occ: line 2: ?php: No such file or directory
    ./occ: line 3: /bin: Is a directory
    ./occ: line 4: syntax error near unexpected token `('
    ./occ: line 4: ` * Copyright (c) 2013 Thomas Müller <thomas.mueller.eu>'
    </thomas.mueller.eu>

    Did I choose the wrong container?

    点赞 评论 复制链接分享
  • weixin_39734074 weixin_39734074 4月前

    HA! I am an idiot. Those were separate commands. First docker exec -it --user www-data $ncinit_app_1 bash THEN ./occ db:add-missing-indices

    点赞 评论 复制链接分享
  • weixin_39734074 weixin_39734074 4月前

    Thanks!

    点赞 评论 复制链接分享

相关推荐