Created
February 7, 2022 15:38
-
-
Save marianobrc/c9e971ba212bb0236c933abcc5c0e881 to your computer and use it in GitHub Desktop.
A script to initialize a PostreSQL database
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
\set DB_NAME `echo "$DB_NAME"` | |
\set DB_USER `echo "$DB_USER"` | |
\set DB_PASSWORD `echo "$DB_PASSWORD"` | |
CREATE USER :DB_USER WITH PASSWORD :'DB_PASSWORD'; | |
CREATE DATABASE :DB_NAME; | |
GRANT ALL PRIVILEGES ON DATABASE :DB_NAME TO :DB_USER; | |
ALTER ROLE :DB_USER CREATEDB; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment