hydromodpy.core.migrations.auto_boot#
Robust boot-time migration with backup, FileLock and rolling history.
ensure_schema_safe wraps hydromodpy.core.migrations.ensure_schema()
with three guarantees that the bare runner does not provide:
a
FileLockon<db>.lockso two processes never migrate the same DuckDB file simultaneously (the bareensure_schemais unlocked).an atomic file-level backup
<db>.bak-<ISO8601Z>taken right before any migration runs, with automatic restore-on-failure if the schema upgrade raises.a rolling history of at most
MAX_BACKUPSsnapshots per database (oldest removed on overflow).
The opt-out HMP_AUTO_MIGRATE=0 raises AutoMigrationDisabled
when a pending migration is detected, leaving the on-disk file untouched.
Functions
|
Return the canonical backup path for |
|
Bring |
|
Return existing backups for |
|
Restore |
Exceptions
|
Raised when |