After setting up my Nextcloud again, I created the usual Joplin folder and set joplin-desktop to sync to that folder. To my surprise it swiftly deleted all my notes.
I still have them on my phone (and I’ve made a backup using Titanium) but when I try to sync to any folder on my Nextcloud instance it deletes all my notes, leaving me to restore the app data with Titanium.
Is there a way for me to force sync the notes on my phone to Nextcloud?
All my notes got deleted after changing the WebDAV URL!
When changing the WebDAV URL, make sure that the new location has the same exact content as the old location (i.e. copy all the Joplin data over to the new location). Otherwise, if there’s nothing on the new location, Joplin is going to think that you have deleted all your data and will proceed to delete it locally too. So to change the WebDAV URL, please follow these steps:
Make a backup of your Joplin data in case something goes wrong. Export to a JEX archive for example.
Synchronise one last time all your data from a Joplin client (for example, from the desktop client)
Close the Joplin client.
On your WebDAV service, copy all the Joplin files from the old location to the new one. Make sure to also copy the .resource directory as it contains your images and other attachments.
Once it’s done, open Joplin again and change the WebDAV URL.
Synchronise to verify that everything is working.
Do step 5 and 6 for all the other Joplin clients you need to sync.
That's easy. If the sync process encounters an empty target, it could ask what to do.
I suggested this to @laurent a while back, but I can't recall the reason for not implementing such a mechanism. But I reckon there was a good reason for it.