stephane-klein / postgresql-pgtap-graphile-migrate-skeleton

PostgreSQL pgTAP and graphile-migrate skeleton
0 stars 0 forks source link

PostgreSQL pgTAP and graphile-migrate skeleton

This repository is a skeleton that integrates pgtap and graphile-worker.

In this skeleton, two PostgreSQL databases are defined in docker-compose.yml:

Why two separate databases? For two reasons:

Important details:

$ asdf install
$ pnpm install
$ ./scripts/init.sh

Next, execute:

$ pnpm run migrate:watch

Execute tests:

$ pnpm run migrate-test:watch
$ ./scripts/tests.sh
/sqls/tests/test1.sql .. ok
All tests successful.
Files=1, Tests=2,  0 wallclock secs ( 0.01 usr  0.00 sys +  0.01 cusr  0.00 csys =  0.02 CPU)
Result: PASS

You can also run a specific test:

$ ./scripts/tests.sh sqls/tests/test1.sql
/sqls/tests/test1.sql .. ok
All tests successful.
Files=1, Tests=2,  0 wallclock secs ( 0.01 usr  0.00 sys +  0.01 cusr  0.00 csys =  0.02 CPU)
Result: PASS

Apply migration in migrations/current.sql and commit:

$ pnpm run migrate:commit