Attributes
Includes Deno configuration
Repository
Current version released
a week ago
Dependencies
Versions
deno.land/x/migraine – Simple Postgres schema management
export DATABASE_URL='postgresql://postgres:pgdev@localhost/pgdev'
deno run \
--allow-env=DATABASE_URL,PGHOST,PGPORT,PGUSER,PGPASSWORD,PGDATABASE,PGAPPNAME,PGOPTIONS \
--allow-net=localhost:5432 \
--allow-read=/migrations,/secrets/pgformyapp \
https://deno.land/x/migraine-postgres/migraine.ts \
--migrations=/migrations \
--auth=myapp=/secrets/pgformyapp(Unfortunately, deno-postgres accesses the PGHOST etc environment variables even when explicitly configured: https://github.com/denodrivers/postgres/issues/418.)
export PGHOST=localhost
export PGPORT=5432
export PGUSER=postgres
export PGPASSWORD=pgdev
export PGDATABASE=postgres
deno run \
--allow-env=DATABASE_URL,PGHOST,PGPORT,PGUSER,PGPASSWORD,PGDATABASE,PGAPPNAME,PGOPTIONS \
--allow-net=localhost:5432 \
--allow-read=/migrations,/secrets/pgformyapp \
https://deno.land/x/migraine-postgres/migraine.ts \
--migrations=/migrations \
--auth=myapp=/secrets/pgformyappPut migrations in a separate directory, with names like 001_description_here.sql.
Put Postgres role passwords each in a separate file.
Features
- SQL schema migrations
- set passwords for Postgres roles
- usable both as a command-line tool and a library
Ideals
- simple
- easily understandable
- robust
Anti-goals
- databases other than Postgres, simpler code is better
- command to create a new file for a migration
- “down” migrations