Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backend/develop -> backend-team #305

Merged
merged 2 commits into from Apr 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 13 additions & 2 deletions scripts/setup.sh
Expand Up @@ -75,10 +75,21 @@ case $yn in
;;
esac

source $SCRIPT_DIR/../.env
[[ -z $DB_USER ]] && DB_USER="postgres"
[[ -z $DB_PASSWORD ]] && DB_PASSWORD=""
[[ -z $DB_HOST ]] && DB_HOST="localhost"
[[ -z $DB_PORT ]] && DB_PORT="5432"

echo ""
if ! psql -c "CREATE DATABASE mercury;" -U postgres 2> /dev/null; then # if it already exists, an error occurs. ignore it
__system "mercury database exists. Skip creating it"
__system "Checking postgres connection..."
psql postgresql://$DB_USER:$DB_PASSWORD@$DB_HOST:$DB_PORT -c "" || exit 1
__success "postgres connection"

if ! psql postgresql://$DB_USER:$DB_PASSWORD@$DB_HOST:$DB_PORT -c "CREATE DATABASE mercury;" 2> /dev/null; then # if it already exists, an error occurs. ignore it
__system "Skip creating mercury database"
fi

__success "mercury database"

echo ""
Expand Down