Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 1.59 KB

README.md

File metadata and controls

37 lines (27 loc) · 1.59 KB

pg_dev

GitHub Workflow Status GitHub

This images uses the official postgres docker image as a base and adds tooling for development. It's considered a drop-in replacement during development, while running the official image in production.

Bundled Tools and Scripts

Currently, the following tools are added:

As well as some helper scripts:

  • tool: Starts a tmux session to control output of other scripts.
  • with async: Runs interactive prompts like a shell or psql without blocking the command chain.
  • with menu: Provides a menu to choose options from other with helpers from.
  • with pg: Sets up a temporary database to run tests against. Inspired by PostgREST.
  • with sql: Wrapper to create schema from .sql file via psql.
  • with watcher: Enable watch mode for tests.

How to use

Mount your source code into the container and run pg_prove with a temporary database in watch mode:

docker run --rm -v "$PWD:/usr/src" \
  tool \
    with menu \
    with watcher \
    with pg \
    with_sql schema.sql \
    with pg_prove -r --ext .spec.sql --pgtap-option suffix=.sql

This will load the schema defined in schema.sql through psql, create the pgTAP extension in a pgtap schema and then run pg_prove on all .spec.sql files found recursively.