Skip to content

Instantly share code, notes, and snippets.

@mdubb86
Last active July 18, 2019 19:28
Show Gist options
  • Select an option

  • Save mdubb86/88140c52dbd7efbd9c255ae2748f3cb8 to your computer and use it in GitHub Desktop.

Select an option

Save mdubb86/88140c52dbd7efbd9c255ae2748f3cb8 to your computer and use it in GitHub Desktop.
Create Postgres DB
\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;
@mdubb86
Copy link
Author

mdubb86 commented Jul 18, 2019

Usage:
curl -s https://gist.githubusercontent.com/mdubb86/88140c52dbd7efbd9c255ae2748f3cb8/raw | psql -d postgres -v name="${NAME}" -v password="${PASSWORD}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment