Expand description
Schema migration tools for SQLite databases
This module provides tools for managing database schema migrations that are stored within the database itself, enabling agents to evolve schemas over time.
§Design
Migrations are stored in a _schema_migrations table within each database:
version: Timestamp-based unique identifier (auto-generated)name: Human-readable descriptionsql: The DDL to executeapplied_at: When the migration was applied (NULL = pending)checksum: SHA256 of the SQL for integrity
§Tools
AddMigrationTool- Store a new pending migrationRunMigrationsTool- Apply all pending migrations in orderListMigrationsTool- List migrations with optional status filterGetMigrationTool- Get details of a specific migrationRemoveMigrationTool- Remove a pending migration before it’s applied
Re-exports§
pub use export::ExportMigrationsTool;pub use import::ImportMigrationsTool;pub use types::Migration;pub use types::MigrationStatusFilter;
Modules§
Structs§
- AddMigration
Tool - Adds a new pending migration to the database
- GetMigration
Tool - Gets details of a specific migration including its SQL
- List
Migrations Tool - Lists all migrations with their status
- Remove
Migration Tool - Removes a pending migration from the database
- RunMigrations
Tool - Runs all pending migrations in version order
Constants§
- MIGRATIONS_
TABLE - The name of the migrations table
Functions§
- compute_
checksum - Computes SHA256 checksum of SQL content
- ensure_
migrations_ table - Ensures the migrations table exists in the database
- generate_
version - Generates a version string based on current timestamp