temp-postgres 0.4.0
temp-postgres is a small utility to run the PostgreSQL server off a temporary directory.
It’s been almost six years since the initial release. The new version completes a major upgrade in terms of user experience and implementation:
- Rewritten in async Rust to improve error and signal handling
- UNIX-style command wrapper option
- Structured logging (also known as tracing)
- Graceful shutdown with configurable timeout
- Experimental Nix flake support
Some examples from the readme, also available on crates.io and lib.rs:
# Install temp-postgres using Cargo.
cargo install temp-postgres-command
# Run temp-postgres using Nix.
nix run git+https://git.skreutz.com/temp-postgres.git -- --help
# Optionally with a fixed PostgreSQL major version.
nix run git+https://git.skreutz.com/temp-postgres.git#temp-postgres_18 -- --help
# Wrap the psql command for an interactive terminal. No configuration necessary.
temp-postgres -- psql
# Run SQLx integration tests against a temporary database.
temp-postgres -- cargo test
# Create a symbolic link to enable static configuration.
temp-postgres --symlink db
psql --host "$(realpath db)"See the changelog for details.