fix: psql should exit nonzero on failure
All checks were successful
migrate-devel / migrate-devel (push) Successful in 3s
migrate-stage / migrate-stage (push) Successful in 3s

This commit is contained in:
Orion Kindel 2023-07-15 18:42:20 -04:00
parent bff2f404dd
commit 2345c61b8c
Signed by untrusted user who does not match committer: orion
GPG Key ID: 6D4165AE4C928719
2 changed files with 1 additions and 7 deletions

View File

@ -28,14 +28,8 @@ if [[ ! -f "$migration" ]]; then
echo "migrate from $rev => HEAD" 1>&2
echo "do language plpgsql \$migration\$" >> "$migration"
echo "begin" >> "$migration"
echo >> "$migration"
migra --unsafe $base_url $head_url >> "$migration" \
|| echo "migra exited with code $?. this is /probably/ fine" 1>&2
echo >> "$migration"
echo "end;" >> "$migration"
echo '$migration$;' >> "$migration"
fi
echo "$migration"

View File

@ -26,7 +26,7 @@ else
migration_file=$(./scripts/diff.sh "$last_revision")
if [[ "$2" = "--greenlight" ]]; then
psql "$POSTGRES_URI/dnim" -f "$migration_file"
psql "$POSTGRES_URI/dnim" -v ON_ERROR_STOP=1 --single-transaction -f "$migration_file"
else
echo "migration available at $migration_file"
echo "review and rerun with --greenlight to apply"