diff options
| -rw-r--r-- | README.md | 57 |
1 files changed, 39 insertions, 18 deletions
@@ -1,26 +1,35 @@ -# Temp PostgreSQL +# temp-postgres -The `temp-postgres` utility runs the PostgreSQL server off a temporary data -directory. See [this][intro] blog post for an introduction. +The `temp-postgres` utility runs the [PostgreSQL](https://www.postgresql.org/) server off a temporary data directory. +See the [original blog post](https://www.skreutz.com/posts/temporary-postgresql-server/) for an introduction. -This project's original source code is hosted [here][home]. - -[intro]: https://www.skreutz.com/posts/temporary-postgresql-server/ -[home]: https://git.skreutz.com/temp-postgres.git/ +The project's source code is hosted on <https://git.skreutz.com/temp-postgres.git/>. ## Usage Create and serve a temporary database: - $ temp-postgres +```sh +temp-postgres +``` + +Specify a database name, and PostgreSQL user name: + +```sh +temp-postgres --dbname myproject --username alex +``` Wrap the `psql` command to connect to the temporary database once the server is ready: - $ temp-postgres -- psql +```sh +temp-postgres -- psql +``` Run [SQLx integration tests](https://docs.rs/sqlx/latest/sqlx/attr.test.html) against a temporary database: - $ temp-postgres -- cargo test +```sh +temp-postgres -- cargo test +``` Or configure `temp-postgres` as a wrapper for [cargo-nextest](https://nexte.st/): @@ -43,27 +52,39 @@ The `temp-postgres` utility depends on `sh(1)` and `postgres(1)`. On OpenBSD you can install the dependencies using `pkg_add(1)`: - $ doas pkg_add postgresql-server postgresql-client +```sh +doas pkg_add postgresql-server postgresql-client +``` On FreeBSD you can install the dependencies using `pkg-install(8)`: - $ sudo pkg install postgresql16-server postgresql16-client +```sh +sudo pkg install postgresql16-server postgresql16-client +``` On Void Linux you can install the dependencies using `xbps-install(1)`: - $ sudo xbps-install -S dash postgresql postgresql-client +```sh +sudo xbps-install -S dash postgresql postgresql-client +``` On Arch Linux you can install the dependencies using `pacman(8)`: - $ sudo pacman -Syu postgresql +```sh +sudo pacman -Syu postgresql +``` ## Installation - $ ./configure - $ make - $ sudo make install +```sh +./configure +make +sudo make install +``` Alternatively you can run (or install) the experimental Nix flake. - $ nix run git+https://git.skreutz.com/temp-postgres.git -- --help +```sh +nix run git+https://git.skreutz.com/temp-postgres.git -- --help +``` |