Which database tables do I have to restore to migrate calendars, contacts and shared files / folders?

I’m running a nextcloud 19 instance with an apparently partly corrupted database. Since fixing the existing database gets more and more difficult, I want to migrate all relevant data to a freshly installed nextcloud 19 instance.

Relevant data means user accounts, files, calendars, contacts and shares, while shares are not absolutely necessary.

So far, user accounts and files I already managed to migrate. Now I want to transfer the calendars, contacts and shares to the new instance. Unfortunately, so far I was not able to find out which database tables belong to the respective data. Could somebody help me with that?

I usually export calendars and contacts as .ics and .vcf files and import them this way in the new nextcloud. Seems to be the most bullet proof way for me, but can’t transfer shares, of course.

… and it is also not possible for my other users, right?

Well, they would need to do it themself - alternatively you can write a script which does a bulk export / import for all - i think the APIs of the calendar and contact apps are public. Depending on your Know-How of course, but i guess you are capable of doing that when you are able to read/write databases directly :man_shrugging::slightly_smiling_face:

A bulk export I have, thanks to BernieO and calcardbackup, but I would prefer not to bother the users with this effort, especially the non-tech ones (the family).
Unfortunately the ability to create the proposed script isn’t available :upside_down_face: at least since I don’t find the API documentation… Shouldn’t a direct database table transfer be the easiest way…?

Well, directly manipulating the database is never a good idea and might lead to a corrupt database (as you experienced) - it’s too easy to forget some triggers oe so which happen in the application.

Maybe you want to open a request in the freelancer category to find someone who is able to do it (if you are willing to spend a few bucks and a coffee :wink:)

I now tried to manually import (via the nextcloud calendar app) the ics data I have from the calcardbackup script and unfortunately some calendars are that big that the import is unsuccessful due to time outs. Consequently, I have to find either a CLI way to import ics and vcf files to the calendars and addressbooks of the respective users, or a direct database transfer…

Normally you restore the full database, move the files back in the correct folders and use “occ files:scan --all”.

backup

restore

occ

Since the database seems to be broken, I only want to transfer the really necessary parts…

Ok sorry. But i think there are dependencies between the tables. But sorry. I am not an developer.