Skip to main content

migrate_format1

Function migrate_format1 

Source
pub fn migrate_format1(
    dir: &Path,
) -> Result<MigrateOutcome, MigrateFormat1Error>
Expand description

Rewrites the format-1 database at dir — a <table>.schema.json per table, next to the logs — into the format-2 metadata catalog the engine reads, in place and offline. The catalog lands first, atomically, and only then do the schema files go: interrupted in between, the directory is a working format-2 database with residue, which is the state Database::open already reads.

Nothing here opens the database, on purpose — the engine refuses format 1, and this is the one way out of it. Take a copy of the directory first; the rewrite is one-way. Shared by hayson-cli‘s migrate-format1 command and both bindings’ migrateFormat1.