Restoring Collectives content after a clean reinstall in Nextcloud AIO

:puzzle_piece: Restoring Collectives content after a clean reinstall in Nextcloud AIO

This guide describes how to fix an issue that can occur after a clean reinstallation of Nextcloud AIO (Docker environment), when the Collectives app is restored only from a manual file backup of the original “Collectives” folder, instead of a full system backup made via BorgBackup.

After such a reinstall, you may find that all your Markdown files are still physically present inside the Collectives folder, but the Collectives app does not display them.
The reason is that no index entries exist in the Nextcloud database — meaning there are no links between the files and the internal identifiers of each Collective.


:hammer_and_wrench: Step-by-step solution

  1. Back up the original Collectives folder
    The safest way is to copy (not move!) the entire Collectives folder through the web interface — for example into Documents.
    This ensures you keep your old content intact without risking deletion of the main Collectives directory. :file_folder:

  2. Empty the Collectives folder
    Delete or rename the old contents of the Collectives folder in the Files app.

  3. Create a new Collective in the Collectives app
    Open the Collectives web app and create a new Collective — you can use the same name as before.
    For example, create a new Collective called Ansible. This will automatically create a new folder Collectives/Ansible in your Files area.

  4. Copy the old content back
    In the Files app, copy all Markdown files from your backup (the old Ansible folder) into the newly created Collectives/Ansible folder.

  5. Repeat for all other Collectives
    For each additional Collective you had before, create a new one in the web app (using the same name) and copy the backed-up content into its folder through Files. :page_facing_up:

  6. Rescan app data to rebuild the database index
    From the host system (not from inside the container), run the following command to update the database entries:

    docker exec --user www-data nextcloud-aio-nextcloud php occ files:scan-app-data
    
    

    :white_check_mark: This command tells Nextcloud to rescan the app data and register the Markdown files in the Collectives database.

  7. Verify the result
    Once the scan is complete, refresh the Collectives app in your browser.
    All your .md files should now appear correctly within their respective Collectives — just like before the reinstall. :tada:


2 Likes