When I start emacs, for some reason my nodes table in the database is emptied. I have no idea what’s doing that yet. This is what happens when I query the nodes table before starting emacs and then after starting emacs:
$ sqlite3 org-roam.db
SQLite version 3.32.3 2020-06-18 14:16:19
Enter ".help" for usage hints.
sqlite> select count(*) from nodes;
1306
sqlite> select count(*) from nodes;
0
sqlite>
Has anyone seen this type of problem? I need to run org-roam-db-sync in order to repopulate the database, every time I run Emacs. I have been working around this problem for a couple months but and ready to figure out the problem and fix it now.
I can’t reproduce it and could not help with solving it.
It is reported that the DB is empty after upgrade of Org-roam and if I understand it correctly, db-sync does not repopulate the DB — different from your issue.
But that didn’t result in all the SQL that’s sent to the database being logged in the resulting buffer. I think if I could see all the commands, I could identify what is issuing a delete statement and trace it back from there.
OK, it took a while for me to get back to this, but I appear to have a partial solution to this problem for now.
I found that I needed to comment out +org-roam-try-init-db-a, which is in org/contrib/roam2.el.
Does anyone know why this function is misbehaving like this? Every time I start Emacs, it creates the tables from scratch, which results in the org-roam-db being wiped.