Expand description
Migration runner for ModKit modules.
This module provides a secure migration execution system that:
- Executes module-provided migrations using a per-module migration history table.
- Does not expose raw database connections or
SQLxpools to modules. - Ensures deterministic, idempotent migration execution.
§Per-Module Migration Tables
Each module gets its own migration history table named modkit_migrations__<prefix>__<hash8>,
where <hash8> is an 8-character hex hash derived from the module prefix via xxh3_64.
This prevents conflicts between modules that might have similarly named migrations.
Examples:
- Test prefix “_test” →
modkit_migrations___test__e5f6a7b8
§Security Model
Modules only provide migration definitions via MigrationTrait. The runtime executes
them using its privileged connection. Modules never receive raw database access.
Structs§
- Migration
Result - Result of a migration run.
Enums§
- Migration
Error - Errors that can occur during migration execution.
Functions§
- get_
pending_ migrations - Check if migrations are pending for a module without applying them.
- run_
migrations_ for_ module - Run migrations for a specific module using a
Db. - run_
migrations_ for_ testing - Run migrations for testing purposes.