Skip to content

Instantly share code, notes, and snippets.

@vrdhn
Last active February 9, 2022 06:14
Show Gist options
  • Save vrdhn/14a6537d987b8efe92a6eb50f3fea51a to your computer and use it in GitHub Desktop.
Save vrdhn/14a6537d987b8efe92a6eb50f3fea51a to your computer and use it in GitHub Desktop.
Disposable Postgresql instance for nodejs testing
"pg:initpg" : "TZ=Etc/UTC initdb --auth-host password -D pgdata --encoding UTF8 --locale=C -U postgres --pwfile=<(echo postgres) || true",
"pg:start" : "pg_ctl -D pgdata -o '-h localhost' -o -i -o '-k \"\"' -l pg.log start || true ",
"pg:stop" : "pg_ctl -D pgdata stop || true ",
"pg:init-role": "psql postgresql://postgres:postgres@localhost:5432/postgres -c \"CREATE ROLE myapp_dev LOGIN PASSWORD 'myapp_dev';\"",
"pg:init-db" : "psql postgresql://postgres:postgres@localhost:5432/postgres -c \"CREATE DATABASE myapp_dev OWNER myapp_dev\"",
"pg:init" : "pnpm pg:init-role ; pnpm pg:init-db",
"pg:psql" : "psql postgresql://myapp_dev:myapp_dev@localhost:5432/myapp_dev",
"pg:go" : "pnpm pg:initpg ; pnpm pg:start ; pnpm pg:init ",
"pg:clean" : "pnpm pg:stop ; rm -fr pgdata ",
"pg:log" : "tail -F pg.log"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment