fix: improve gen_migrations and diff
Some checks reported warnings
gen-migrations / gen-migrations (push) Has been cancelled

This commit is contained in:
Orion Kindel 2023-07-20 12:00:43 -05:00
parent b9d80dd04f
commit 60a672d45c
Signed by untrusted user who does not match committer: orion
GPG Key ID: 6D4165AE4C928719
4 changed files with 14 additions and 4 deletions

View File

@ -12,7 +12,7 @@ services:
test: [ "CMD-SHELL", "pg_isready" ]
interval: 1s
timeout: 1s
retries: 10
retries: 30
head:
container_name: 'head'
network_mode: 'host'
@ -22,7 +22,7 @@ services:
volumes: ['/var/run/postgresql:/var/run/postgresql']
command: '-p 5433'
healthcheck:
test: [ "CMD-SHELL", "pg_isready" ]
test: [ "CMD-SHELL", "pg_isready -p 5433" ]
interval: 1s
timeout: 1s
retries: 10
retries: 30

@ -1 +1 @@
Subproject commit b5740338f3a2b64c480fdf2416d44346bcfc3b27
Subproject commit 359aa9bf7cf72ae7dbe473072bab0f0ecd449813

View File

@ -8,6 +8,9 @@ source ./scripts/env.sh ./.env.schema
base_or_head="$1"
rev="$2"
docker compose kill "$base_or_head"
docker compose rm -vf "$base_or_head"
if [[ "$base_or_head" = "head" ]]; then
port=5433
else

View File

@ -23,11 +23,18 @@ if [[ -z "$base" ]] || [[ -z "$head" ]]; then
exit 1;
fi
if ! (git diff --quiet "$base..$head" -- ./schema); then
echo ""
exit 0;
fi;
if [[ ! -f "$migration" ]]; then
docker compose down -v
./scripts/build.sh base "$base" 1>&2 || (echo "base failed to build" && exit 1)
./scripts/build.sh head "$head" 1>&2 || (echo "head failed to build" && exit 1)
until pg_isready --quiet -p 5432 && pg_isready --quiet -p 5433; do true; done;
migra --unsafe "$(db 5432)" "$(db 5433)" || echo "migra exited with code $?. this is /probably/ fine" 1>&2
else
cat "$migration"