Evaluate PRAGMA user_version for schema versioning
Description
GET /version currently exposes schema_version as the lexicographically last migration filename from the schema_migrations table. This requires the table to exist (migrations must have run). SQLite's built-in PRAGMA user_version is a 4-byte integer in the DB header readable on any SQLite file before migrations run.
Acceptance Criteria
-
Evaluate whether
PRAGMA user_versionis needed alongside the filename-based approach -
If yes: update each migration to set
PRAGMA user_versionto its sequence number; expose both inGET /version -
If no: document in
ARCHITECTURE.mdwhy the filename approach is sufficient -
Decision recorded as an ADR in
docs/ARCHITECTURE.md
Additional information
The key question is whether any supported use case (e.g. import compatibility checks, tooling that inspects a .db file before attaching it to a running Snackbox instance) requires reading the schema version before migrations have run. If not, the filename approach is sufficient.