mirror of
https://github.com/narrrl/narl-workspace.git
synced 2026-11-03 16:41:27 +01:00
data/uploads/<uuid> is what a restore needs but nobody can find a PDF in it. files/<space>/<folder>/<name> holds the same bytes as the tree shows them. Renames and moves become renames and moves on Drive, gone files go to Drive's trash, emptied folders follow, and clashing names get the later node's id. Failures there are logged, not fatal: the restorable copy in data/ is already up when the view runs.
21 lines
813 B
SQL
21 lines
813 B
SQL
-- Bookkeeping for `files/` on the device: the file nodes laid out as the tree
|
|
-- shows them, so Proton Drive's own apps can open them by name.
|
|
--
|
|
-- One row per file node mirrored there. No foreign key to `nodes`: the row has
|
|
-- to outlive the node, because it is how the mirror knows what to trash once
|
|
-- the node is gone. `media_id` is what was uploaded; a node whose bytes change
|
|
-- is uploaded again.
|
|
CREATE TABLE backup_view (
|
|
node_id INTEGER PRIMARY KEY,
|
|
path TEXT NOT NULL,
|
|
media_id TEXT NOT NULL,
|
|
node_uid TEXT NOT NULL
|
|
);
|
|
|
|
-- Every folder made under `files/`, by its path there, so one that ends up
|
|
-- empty can be trashed and the rest are not looked up again on every run.
|
|
CREATE TABLE backup_view_dirs (
|
|
path TEXT PRIMARY KEY,
|
|
node_uid TEXT NOT NULL
|
|
) WITHOUT ROWID;
|