Restoring Logseq DB from TimeMachine backup

Today I had to restore a graph database from a backup for the first time. I think I need to talk to someone about this traumatic experience.

The problem

On day one, I created a page with a lot of assets (screenshots).

On day two, I created several new pages, and discovered that most of yesterday’s assets were missing. Yesterday’s page was kind of okay, but also with a few nodes missing.

The fix

My goal was to restore the corrupted page with all its assets while keeping safe new resources from day two. I planed to restore the DB graph from a day-one backup and copy the corrupted page to the current graph.

It did not work well. For regular nodes, a user can select a bunch of them, copy, and paste them into a new place. But that does not work for assets: I ended up copying them one by one.

My questions

First, obviously, is there a way to copy all assets from one graph to another? Sure, we can copy files from the assets folder, but that is not enough to restore the pages with these assets.

Second, a less obvious question: what is the right way to open the restored DB graph as a new graph?

I tried to create a new DB graph and then replace the ⁠db.sqlite file and assets folder with the restored one. Somehow that did not work. What worked is importing the graph from restored files with “import existing notes” and then copying the restored assets folder to the created graph folder.

I have a strong feeling that I’m doing something wrong here, so I would appreciate any feedback.