Migrations
DearDiary.Migration — Type
MigrationA forward-only schema migration applied by apply_migrations.
Fields
version::Int: Monotonically increasing version number. Determines application order and is the primary key in theschema_migrationstracking table — once a version is committed, do not reuse it.name::String: Short human-readable identifier (snake_case). Logged on application and stored alongside the version for debugging.statements::Vector{String}: SQL statements applied in order. Each statement runs throughDBInterface.execute, matching how the rest of the repository talks to SQLite.
DearDiary.apply_migrations — Function
apply_migrations(db::SQLite.DB)::NothingApply every Migration in MIGRATIONS whose version is not yet recorded in schema_migrations, in ascending order. Each migration's statements run sequentially via DBInterface.execute; the version is stamped into schema_migrations only after every statement succeeds, so a crash mid-migration leaves the registry untouched and the migration is retried on next startup.
DearDiary.applied_versions — Function
applied_versions(db::SQLite.DB)::Set{Int}Return the set of migration versions already recorded in schema_migrations. Creates the tracking table on first call so a freshly-opened database needs no special bootstrap.