Skip to content

Commit

Permalink
[dev] Document psql preference
Browse files Browse the repository at this point in the history
  • Loading branch information
jhf committed May 5, 2024
1 parent 191acef commit 10a1704
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions devops/manage-statbus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ EOS
;;
'psql' )
eval $(./devops/manage-statbus.sh postgres-variables)
if $(which psql > /dev/null && false); then
# The local psql is always tried first, as it has access to files
# used for copying in data.
if $(which psql > /dev/null); then
psql "$@"
else
# When using scripted input, such as "< some.sql" then interactive TTY is required.
Expand All @@ -299,7 +301,7 @@ EOS
args="-ti"
fi
COMPOSE_INSTANCE_NAME=$(./devops/dotenv --file .env get COMPOSE_INSTANCE_NAME)
docker exec $args -e PGPASSWORD=$PGPASSWORD $(docker ps | awk "/$COMPOSE_INSTANCE_NAME-db/{print \$1}") psql -U $PGUSER $PGDATABASE "$@"
docker exec $args -e PGPASSWORD $(docker ps | awk "/$COMPOSE_INSTANCE_NAME-db/{print \$1}") psql -U $PGUSER $PGDATABASE "$@"
fi
;;
'generate-types' )
Expand Down

0 comments on commit 10a1704

Please sign in to comment.