diff --git a/scripts/init_db.sh b/scripts/init_db.sh index eb9bf07..bfb940d 100755 --- a/scripts/init_db.sh +++ b/scripts/init_db.sh @@ -2,6 +2,19 @@ set -x set -eo pipefail +if ! [ -x "$(command -v psql)" ]; then + echo >&2 "Error: `psql` is not installed." + exit 1 +fi + +if ! [ -x "$(command -v sqlx)" ]; then + echo >&2 "Error: `sqlx` is not installed." + echo >&2 "Use:" + echo >&2 " cargo install --version=0.5.5 sqlx-cli --no-default-features --features postgres" + echo >&2 "to install it." + exit 1 +fi + # Check if a custom user has been set, otherwise default to 'postgres' DB_USER="${POSTGRES_USER:=postgres}" # Check if a custom password has been set, otherwise default to 'password'