minco-sqlx-postgres
Bounded SQLx PostgreSQL runtime support for Minco.
The serverless profile defaults to a small pool with zero minimum connections, a bounded acquisition timeout, and an idle timeout. Runtime and migration credentials should remain separate in deployed environments.
use ;
# async
Applications that compose independently versioned migration sets must give each set its own history table:
# use PgPool;
# async
The history-table name is restricted to a plain PostgreSQL identifier. Reusing
SQLx's default _sqlx_migrations table for unrelated migration directories
causes version/checksum collisions.
The framework lifecycle API accepts a validated minco_db::MigrationSet:
# use MigrationSet;
# use PgPool;
# use Path;
# async
The adapter revalidates backend, SQL identifiers, project containment and resolved SQLx checksums immediately before execution. SQLx's PostgreSQL advisory migration lock remains enabled for the whole run.
Validated minco_db::SeedPlan values execute with backend-specific SQL. A
required plan uses one transaction; source digests are rechecked before that
transaction starts. verify_seed_plan runs every declared boolean check in a
read-only PostgreSQL transaction.
Durable audit ledger
audit_v2::PostgresAuditJournal::enqueue_in writes a bounded audit intent in
the caller's domain transaction. Concurrent relays claim disjoint batches with
FOR UPDATE SKIP LOCKED; source rows are acknowledged only after an idempotent
ledger transaction commits. Same-ID/same-content races are duplicates, while a
same-ID/different-content race rolls back the whole batch.
Run plugin_adapters::migrate_plugin_storage against the operational database
and audit_v2::migrate_audit_ledger against a distinct audit database.
validate_separate_audit_pools fails closed when both pools resolve to the same
database identity. Resource-history queries use only the permanent ledger and
its bounded related-resource projection.
PostgresAuditStorageInspector reports relation/index bytes, source backlog and
quarantined records. PostgreSQL retention or partition/archive jobs remain
explicit deployment operations; this adapter does not add a hidden scheduler or
delete history automatically.