Expand description
Forward-only SQLite migrator for the LinkMarks store.
Each migration is a Migration { version, description, sql } entry in
the MIGRATIONS slice. migrate(conn) runs every un-applied migration
inside a single transaction and stamps PRAGMA user_version with the
final version. Re-running migrate on an up-to-date DB is a no-op.
The migrator does not support downgrades. Forward-only matches the
LinkMarks operational model (snapshot + restart beats destructive
rollback). Detecting a newer schema than the highest known migration
returns CoreError::Storage with a newer schema prefix so callers
can surface a clear upgrade error.
Structs§
- Migration
- One forward migration.
sqlmay contain any number of statements separated by;.versionis monotonically increasing and is stamped intoPRAGMA user_versionafter the migration commits.
Constants§
- MAX_
SUPPORTED_ VERSION - Highest migration version known to this binary. The migrator will
reject any DB whose
user_versionexceeds this constant. - MIGRATIONS
- All known migrations. Append-only.
- MIGRATION_
001_ SQL - SQL body for migration version 1. Stored separately so the const initializers above stay readable.
Functions§
- applied_
versions - Returns the list of versions currently recorded in
schema_migrations. - current_
user_ version - Read the current
PRAGMA user_versionfrom the connection. - migrate
- Run every un-applied migration in a single transaction and stamp
PRAGMA user_versionwith the final version.