Reconcile the schema/migration docs with the code (closes #68)
check / check (pull_request) Successful in 3m0s

Four documents implied vaultik has no schema-application mechanism and
told contributors to edit a nonexistent `schema.sql`. The code does have
numbered files in `internal/database/schema/` (`000.sql` creates the
`schema_migrations` table, `001.sql` the application tables) that
bootstrap a fresh database.

docs/DATAMODEL.md now owns the explanation, distinguishing the unchanged
policy (no upgrade path between versions; delete the local index and
re-back-up) from the bootstrap mechanism that does exist. README (caveat
and roadmap) and AGENTS.md are reworded to match and link there. AGENTS.md
now names the real file to edit and notes that the pre-1.0 disposability
clause expires on tagging.

Policy is unchanged; docs only.

model: claude-opus-4-8
This commit is contained in:
2026-09-21 19:30:38 +00:00
parent 5927e1aa3d
commit 14e0592c9a
3 changed files with 45 additions and 15 deletions
+24 -5
View File
@@ -5,11 +5,30 @@
Vaultik uses a local SQLite database to track file metadata, chunk mappings, and blob associations during the backup process. This database serves as an index for incremental backups and enables efficient deduplication.
**Important Notes:**
- **No Migration Support (pre-1.0)**: Vaultik does not support database schema
migrations. The local index is treated as disposable — if the schema changes,
delete the local SQLite database (`vaultik database delete`) and run a full
backup. The remote storage is unaffected; the new index will re-deduplicate
against existing remote blobs.
This section is the authoritative explanation of the schema/migration story;
other documents (the README and `AGENTS.md`) link here.
- **No upgrade path between versions (pre-1.0)**: Vaultik has no supported way to
carry an existing local index across a schema change. The index is disposable
— if the on-disk schema changes between versions, delete the local SQLite
database (`vaultik database delete`) and run a full backup. Remote storage is
unaffected; the new index re-deduplicates against existing remote blobs. This
is the standing project policy, and it is separate from the schema bootstrap
described next.
- **Schema bootstrap**: a fresh database is populated from numbered SQL files
embedded in the binary under `internal/database/schema/`. `000.sql` creates the
`schema_migrations` table; `001.sql` creates the application tables. On opening
a database the code applies each numbered file that has not yet run and records
its version in `schema_migrations`. This bootstraps a new database; it does not
upgrade an existing one between released versions.
- **Changing the schema (pre-1.0)**: edit `internal/database/schema/001.sql` (and
the code that touches the affected tables) directly. Do not add new numbered
files — there is no installed base to migrate.
- **Disposability expires at 1.0**: the index is treated as disposable only until
1.0 ships and is tagged. Once 1.0 is tagged that clause expires and the
question of upgrading existing indexes returns. It is deliberately left open
here.
- **Version Compatibility**: In rare cases, you may need to use the same version
of Vaultik to restore a backup as was used to create it. This ensures
compatibility with the metadata format stored in S3.