pub const VAULT_SCHEMA_VERSION: u32 = 3;Expand description
The vault-document schema this build writes.
Three binaries — the desktop app, unv-server and unv — read and write
one untyped JSON blob, and until this existed nothing recorded which shape it
was in. The problem had already been hit once and solved by convention: the
legacy rate_limit string is dual-written so a vault edited by a current
build stays readable to an older one. The next field that skips that
convention breaks old readers with no way to detect it and no way to refuse.
Bump this when a change makes a document unreadable to the previous build — not for an added optional field, which older readers ignore harmlessly.
Version 1 is the document shape as of 0.8.1: the whole vault as one JSON string in one row. Vaults written before this constant existed carry no version at all; that is treated as 1, because it is.
Version 2 (Phase 30) is row-per-entry storage (see storage). A v1 vault
is converted on first open, after a vault.db.v1.bak copy; a v1 build then
refuses the file with SCHEMA_ERR instead of reading an empty blob.
Version 3 (Phase 30.2) gives every chunk of a project a row of its own. A v2 vault loads unchanged (a project row with inline chunks is understood) and is rewritten into chunk rows by its first save; a v2 build then refuses the file, because it would read a project with no chunks and delete the chunk rows.