Last active
September 17, 2020 01:12
-
-
Save henrywoody/22c6df8b8562149fe4f7a7450f84ea7b to your computer and use it in GitHub Desktop.
Postgres Database Setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Requires the following environment variables: | |
-- - `DB_NAME` | |
-- - `DB_USER` | |
-- - `DB_PASS` | |
-- To run (in shell): | |
-- `psql postgres -h $DB_HOST -p $DB_PORT -f /path/to/setup-db.sql` | |
\set db_name `echo $DB_NAME` | |
\set db_user `echo $DB_USER` | |
\set db_pass `echo $DB_PASS` | |
CREATE DATABASE :db_name; | |
CREATE ROLE :db_user WITH LOGIN PASSWORD :'db_pass'; | |
GRANT ALL PRIVILEGES ON DATABASE :db_name TO :db_user; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment