Last active
April 7, 2020 15:51
-
-
Save Apreche/19495f6832534bfa45bd60835a233043 to your computer and use it in GitHub Desktop.
Create a new PostgreSQL database and user for local development
This file contains 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
#!/usr/bin/env bash | |
# Create a postgres database, user, and password for a local dev app | |
psql << EOF | |
CREATE DATABASE $1; | |
CREATE USER $1 WITH PASSWORD '$1'; | |
ALTER ROLE $1 SET client_encoding to 'utf8'; | |
ALTER ROLE $1 SET default_transaction_isolation TO 'read committed'; | |
ALTER ROLE $1 SET timezone to 'UTC'; | |
GRANT ALL PRIVILEGES on DATABASE $1 to $1; | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment