Skip to content

Commit

Permalink
Add support for postgres in ws db console (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
andytson-inviqa authored Nov 29, 2023
1 parent f3e63c6 commit b3b5e05
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion harness/config/commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,21 @@ command('db-console'): |
command('db console'):
env:
COMPOSE_BIN: = @('docker.compose.bin')
DB_PLATFORM: = @('database.platform')
exec: |
#!bash(workspace:/)|@
passthru "$COMPOSE_BIN exec console bash -c 'mysql --host \"\$DB_HOST\" --user \"\$DB_USER\" -p\"\$DB_PASS\" \"\$DB_NAME\"'"
case "${DB_PLATFORM}" in
mysql)
passthru $COMPOSE_BIN exec console bash -c 'mysql --host "$DB_HOST" --user "$DB_USER" -p"$DB_PASS" "$DB_NAME"'
;;
postgres)
passthru $COMPOSE_BIN exec console bash -c 'PGPASSWORD="$DB_PASS" psql --host="$DB_HOST" --username="$DB_USER" --dbname="$DB_NAME"'
;;
*)
echo "error: database.platform attribute value '${DB_PLATFORM}' not supported" >&2
exit 1
;;
esac
command('assets download'):
env:
Expand Down

0 comments on commit b3b5e05

Please sign in to comment.