+ postgresql server & pgadmin
This commit is contained in:
16
bash/psql.sh
Executable file
16
bash/psql.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
# psql in the pgsql container. Usage: ./psql.sh [database] [user] — defaults: intai intai
|
||||
SCRIPT_DIR="$(realpath $(dirname "$(readlink -f "$0")"))"
|
||||
|
||||
. $SCRIPT_DIR/_docker-cmd.sh || {
|
||||
echo "no docker cmd is presented" && exit 1
|
||||
}
|
||||
|
||||
CONTAINER=$(docker ps --filter "label=com.docker.compose.service=pgsql" --format '{{.ID}}' | head -n1)
|
||||
|
||||
if [[ -z "${CONTAINER}" ]]; then
|
||||
echo "Unable to find container: pgsql"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$DOCKER_CMD exec -ti ${CONTAINER} psql -U "${2:-intai}" -d "${1:-intai}"
|
||||
Reference in New Issue
Block a user