fix: psql should exit nonzero on failure
This commit is contained in:
parent
bff2f404dd
commit
2345c61b8c
@ -28,14 +28,8 @@ if [[ ! -f "$migration" ]]; then
|
|||||||
|
|
||||||
echo "migrate from $rev => HEAD" 1>&2
|
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" \
|
migra --unsafe $base_url $head_url >> "$migration" \
|
||||||
|| echo "migra exited with code $?. this is /probably/ fine" 1>&2
|
|| echo "migra exited with code $?. this is /probably/ fine" 1>&2
|
||||||
echo >> "$migration"
|
|
||||||
echo "end;" >> "$migration"
|
|
||||||
echo '$migration$;' >> "$migration"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$migration"
|
echo "$migration"
|
||||||
|
@ -26,7 +26,7 @@ else
|
|||||||
migration_file=$(./scripts/diff.sh "$last_revision")
|
migration_file=$(./scripts/diff.sh "$last_revision")
|
||||||
|
|
||||||
if [[ "$2" = "--greenlight" ]]; then
|
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
|
else
|
||||||
echo "migration available at $migration_file"
|
echo "migration available at $migration_file"
|
||||||
echo "review and rerun with --greenlight to apply"
|
echo "review and rerun with --greenlight to apply"
|
||||||
|
Loading…
Reference in New Issue
Block a user