Created
April 22, 2022 13:52
-
-
Save jship/6fd2a9ed64010af44da7e3fb3caa5202 to your computer and use it in GitHub Desktop.
Gross script to whack all pg data and make a fresh 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
#!/usr/bin/env bash | |
set -o errexit | |
set -o pipefail | |
[[ "${DEBUG}" == 'true' ]] && set -o xtrace | |
brew services stop postgresql@12 | |
rm -rf /usr/local/var/postgresql\@12/ | |
initdb -E utf8 -U postgres /usr/local/var/postgresql\@12/ | |
sleep 5 | |
psql -v ON_ERROR_STOP=1 -U postgres <<-EOSQL | |
CREATE USER "foo" WITH PASSWORD 'foo'; | |
CREATE DATABASE "foo"; | |
GRANT ALL PRIVILEGES ON DATABASE "foo" TO "foo"; | |
EOSQL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment