Skip to content
This repository has been archived by the owner on Feb 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #689 from spryker/feature/allow-setup-to-determine…
Browse files Browse the repository at this point in the history
…-postgres-version-and-use-it

Allow setup to determine postgres version and use it dynamically
  • Loading branch information
dereuromark authored Oct 19, 2017
2 parents ae95ab3 + bafe719 commit 5042848
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions deploy/setup/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CURL=`which curl`
NPM=`which npm`
GIT=`which git`
PHP=`which php`
PG_VERSION=$(psql --version | awk '{print $3}' | cut -f1,2 -d'.')

if [[ `echo "$@" | grep '\-v'` ]]; then
VERBOSITY='-v'
Expand Down Expand Up @@ -104,7 +105,7 @@ function dropAndRestoreDatabase {
mysql -u${DATABASE_USER} -p${DATABASE_PASSWORD} -e "CREATE DATABASE ${DATABASE_NAME};"
mysql -u${DATABASE_USER} -p${DATABASE_PASSWORD} ${DATABASE_NAME} < ${DATABASE_BACKUP_PATH}
else
sudo pg_ctlcluster 9.4 main restart --force
sudo pg_ctlcluster $PG_VERSION main restart --force
sudo dropdb $DATABASE_NAME
sudo createdb $DATABASE_NAME
pg_restore -i -h 127.0.0.1 -p 5432 -U $DATABASE_USER -d $DATABASE_NAME -v $DATABASE_BACKUP_PATH
Expand Down Expand Up @@ -256,7 +257,7 @@ function dropDevelopmentDatabase {
if [[ -f $PG_CTL_CLUSTER ]] && [[ -f $DROP_DB ]]; then
labelText "Deleting PostgreSql Database: ${DATABASE_NAME} "
labelText "Drop PostgresSQL database: ${DATABASE_NAME}"
sudo pg_ctlcluster 9.4 main restart --force && sudo -u postgres dropdb $DATABASE_NAME 1>/dev/null
sudo pg_ctlcluster $PG_VERSION main restart --force && sudo -u postgres dropdb $DATABASE_NAME 1>/dev/null
writeErrorMessage "Deleting DB command failed"
fi

Expand Down

0 comments on commit 5042848

Please sign in to comment.