Reconcile the schema/migration story across code and four documents #68
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Four documents say vaultik has no migrations; the code has a numbered
schema-application framework with a
schema_migrationstable. And the onedocument that tells contributors what to edit names a file that does not
exist.
The code
internal/database/database.go:35—//go:embed schema/*.sqlcollectMigrations(:303),bootstrapMigrationsTable(:324),applyMigrations(:356), inserting intoschema_migrations(:405)internal/database/schema/000.sql(createsschema_migrations) andinternal/database/schema/001.sql(all tentables)
The docs
schema changes between versions, delete the local database…"
docs/DATAMODEL.md:8-12— "No Migration Support (pre-1.0)"AGENTS.md:105-109— "Pre-1.0: NEVER write database migrations… justchange
schema.sql"schema.sqldoes not exist —find . -name schema.sqlreturnsnothing. A contributor or agent following
AGENTS.mdtoday edits anonexistent file. That is the concrete bug here.
Framing
These are less contradictory than they look, and the fix should not
overcorrect. The standing project decision is that migrations are not
supported: schema upgrades are handled by deleting the local state file
and re-running a full backup. That decision stands and is not up for
revision in this issue.
What exists in the code is a schema application mechanism (apply
numbered files to a fresh database and record which ran), not an upgrade
path between released versions. The docs are describing the policy; the
code is describing the bootstrap. Both can be true — the wording just has
to stop implying the
schema_migrationstable is absent.Definition of done
AGENTS.md:105-109names the real files (internal/database/schema/ NNN.sql) and describes the actual procedure for changing the schemapre-1.0. The string
schema.sqlno longer appears anywhere.docs/DATAMODEL.md:8-12arereworded to distinguish "no supported upgrade path between versions —
delete the local index and re-back-up" (the policy, unchanged) from
the numbered schema files and
schema_migrationstable that do exist.No document may assert the table does not exist.
and the local index remains disposable pre-1.0.
AGENTS.md's "disposable until 1.0 ships and istagged" clause expires on tagging, so the question returns at release
time. Do not attempt to answer it now.
make fmtover changed markdown;make checkgreen.