hydromodpy.core.migrations#

Generic Alembic-like schema migration runner shared by all DuckDB components.

The same runner serves multiple isolated components (catalog, global index, workspace cache, …) by parametrizing component and versions_dir on each call.

Public API#

  • ensure_schema(): bring a component up to the latest version.

  • current_version(): highest applied version (0 if none).

  • target_version(): highest version on disk.

  • discover_migrations(): ordered Migration records.

  • Migration: Pydantic record for one migration file.

  • Errors: MigrationError, SchemaIntegrityError, MigrationDiscoveryError, MigrationExecutionError.

Modules

auto_boot

Robust boot-time migration with backup, FileLock and rolling history.

errors

Typed errors raised by the generic schema migration runner.

runner

Alembic-like migration runner generic over DuckDB databases.