Last active
July 18, 2019 19:28
-
-
Save mdubb86/88140c52dbd7efbd9c255ae2748f3cb8 to your computer and use it in GitHub Desktop.
Create Postgres DB
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
| \c postgres | |
| drop database if exists :name; | |
| drop role if exists :name; | |
| create role :name with login noinherit password :'password'; | |
| create database :name owner :name; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
curl -s https://gist.githubusercontent.com/mdubb86/88140c52dbd7efbd9c255ae2748f3cb8/raw | psql -d postgres -v name="${NAME}" -v password="${PASSWORD}"