Expand description
Schema versioning and migration support for PostgresTaskStore.
This module provides a lightweight, forward-only migration runner that tracks
applied schema versions in a schema_versions table. Migrations are defined
as plain SQL strings and are executed inside transactions for atomicity.
§Built-in migrations
| Version | Description |
|---|---|
| 1 | Initial schema — tasks table with indexes on context_id and state |
| 2 | Add composite index on (context_id, state) for combined filter queries |
§Example
use a2a_protocol_server::store::pg_migration::PgMigrationRunner;
use sqlx::postgres::PgPoolOptions;
let pool = PgPoolOptions::new()
.connect("postgres://user:pass@localhost/a2a")
.await?;
let runner = PgMigrationRunner::new(pool);
let applied = runner.run_pending().await?;
println!("Applied migrations: {applied:?}");Structs§
- PgMigration
- A single schema migration.
- PgMigration
Runner - Runs schema migrations against a
PostgreSQLdatabase.
Statics§
- BUILTIN_
PG_ MIGRATIONS - Built-in migrations for the
PostgresTaskStoreschema.