Skip to main content

Crate soma_schema

Crate soma_schema 

Source
Expand description

§soma-schema

A standalone Postgres migration tool — plain SQL files with UP/DOWN sections, manifest-driven ordering, SHA-256 checksum drift detection, and advisory-lock safety to prevent concurrent up/down runs.

Differentiators: (1) manifest-first ordering (not filename-lexical) for FK-safe rollback; (2) checksum on the full raw file (UP + DOWN) so even editing the DOWN section of an applied migration is caught; (3) apply + track in a single transaction (no split state on crash); (4) advisory lock scoped to the whole up/down call (not per-migration).

§Quick start

let pool = sqlx::PgPool::connect("postgres://localhost/mydb").await?;
let config = PostgresConfig {
    schema: Some("app".into()),
    ..Default::default()
};
let driver = PostgresDriver::new(pool, config)?;
let migrator = Migrator::from_root("migrations");
migrator.up(&driver).await?;

Re-exports§

pub use agent_rules::install_skill;
pub use agent_rules::write_rules;
pub use agent_rules::RulesTarget;
pub use discovery::discover;
pub use driver::AppliedMigration;
pub use driver::LockGuard;
pub use driver::MigrationDriver;
pub use error::Error;
pub use error::Result;
pub use migration::Migration;
pub use migration::SetupFile;
pub use migrator::MigrationStatus;
pub use migrator::Migrator;
pub use migrator::PendingMigration;
pub use postgres::PostgresConfig;
pub use postgres::PostgresDriver;
pub use explorer::build_json;
pub use explorer::render_html;
pub use include_dir;

Modules§

agent_rules
discovery
driver
error
explorer
Visual schema + migration explorer — builds JSON and HTML output.
manifest
migration
migrator
postgres