I opened the database first with Jailer so that I can take a peek at the schema but there's no FK constraints etc.You have to do some investigation first.For example the parent_id of table Notes is the id of the Folder, whilst the notes who have tags can be found in note_tags.
Sure it's risky business, but so far my experiments seems to have gone well.I did a VACCUM at the end which saved off 3gb