From: Nicolas Boisselier Date: Thu, 7 Mar 2019 01:17:47 +0000 (+0000) Subject: lib/postgres/update.sh X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=fb336e78d6da25b2faca73b677113dcb08320e65;p=nb.git lib/postgres/update.sh --- diff --git a/lib/postgres/update.sh b/lib/postgres/update.sh index a94bfb11..d90c0446 100755 --- a/lib/postgres/update.sh +++ b/lib/postgres/update.sh @@ -5,5 +5,9 @@ cd "$(dirname "$0")" DB=${1:?Db name missing} psql "$DB" -Atc '\dt' | grep '^public|' | cut -d'|' -f2 | while read t; do - grep -vE '^DROP|--' $t.sql 2>/dev/null -done | psql "$DB" -q + + [ -r "$t.sql" ] || continue + echo "SELECT 'Update $t' as Comment;" + grep -vE '^DROP' "$t.sql" + +done | PGOPTIONS='--client-min-messages=warning' psql "$DB" -qAt