Expand description
Backup and recovery: dump every registered model’s rows to JSON, load them back.
The two halves are symmetric. dump walks
migrate::registered_models(), runs SELECT * FROM <table> for
each, and dispatches per column’s SqlType to read every value
out as a serde_json::Value. load reads the JSON back and
inserts each row through sqlx::query with the same per-column
dispatch on the binding side.
The on-disk format is one JSON document with a small envelope:
{
"umbral_dump_version": "1",
"exported_at": "2026-05-30T17:00:00Z",
"models": [
{ "table": "post", "rows": [{"id": 1, "title": "..."}] },
{ "table": "tag", "rows": [{"id": 1, "name": "..."}] }
]
}§v1 scope
- Every
SqlTypevariant in the M3 catalogue: integer widths, floats, bool, text, date/time/timestamptz, uuid, plus their nullable forms. - One-shot dump + load. No partial dumps, no streaming.
- Order-independent:
loaddoesn’t assume a particular model sequence; rows insert into existing tables (the schema must be present, which is whatumbral-cli migrateis for).
§Deferred
- Schema-snapshot embedding for forward-compat (the dump captures data only; the receiver needs a compatible schema).
- Streaming for very large databases.
- Selective dump / load with model filters.
Structs§
- Dump
- The on-disk envelope.
modelsorder is the orderdumpwrote them in (sorted by table name for determinism).exported_atis captured at dump time for traceability;loaddoesn’t read it. - Load
Report - What
loaddid. Tables present in the dump but not in the current schema land inskipped_tables(not an error; the dump might be from a richer schema). - Model
Dump - One table’s worth of rows. The
tablefield carries the SQL table name (Model::TABLE), not the Rust struct name, so a load against a schema that ran#[umbral(table = "...")]overrides still finds the right destination.
Enums§
- Backup
Error - Errors the dump / load pipeline can produce.
Functions§
- dump
- Dump every registered model’s rows to a
Dumpvalue. The ambient pool (published byApp::build) is the source. - dump_
to_ path - Convenience: dump and write the JSON to
path. - load
- Load a
Dumpback into the database. Schema must already exist (runumbral-cli migratefirst). Rows insert viasqlx::querywith per-column type dispatch; the ambient pool is the target. - load_
from_ path - Convenience: read the JSON from
pathand load it.