From 5169bcbfd2b65fb7d4e2d0b06f138c847ddb4008 Mon Sep 17 00:00:00 2001 From: Orion Kindel Date: Wed, 19 Jul 2023 19:09:20 -0500 Subject: [PATCH] fix: gen-migrations workflow --- scripts/build.sh | 3 ++- scripts/diff.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 9be0689..2849d06 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -18,6 +18,7 @@ docker compose stop "$base_or_head" 1>/dev/null docker compose rm -f "$base_or_head" 1>/dev/null db() { + echo -n "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD/$1?port=$port" echo -n "postgresql:///$1?port=$port&user=$POSTGRES_USER&password=$POSTGRES_PASSWORD" } @@ -62,4 +63,4 @@ docker compose up -d "$base_or_head" 1>/dev/null isready initdb -ls ./schema/ | xargs -I{} bash -c "set -e; $(declare -f query_file); query_file $(db dnim) ./schema/{}" +ls ./schema/ | xargs -I{} bash -c "set -e; $(declare -f query_file); query_file \"$(db dnim)\" ./schema/{}" diff --git a/scripts/diff.sh b/scripts/diff.sh index 6769cc8..5770f05 100755 --- a/scripts/diff.sh +++ b/scripts/diff.sh @@ -29,7 +29,7 @@ if [[ ! -f "$migration" ]]; then until pg_isready -p 5432 1>/dev/null && pg_isready -p 5433 1>/dev/null; do true; done; - migra --unsafe $(db 5432) $(db 5433) || echo "migra exited with code $?. this is /probably/ fine" 1>&2 + migra --unsafe "$(db 5432)" "$(db 5433)" || echo "migra exited with code $?. this is /probably/ fine" 1>&2 else cat "$migration" fi