From fe77ab9d9019a16046921228975630f77e5d66ee Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Thu, 7 Mar 2019 00:47:20 +0000 Subject: [PATCH] lib/postgres/update.sh --- lib/postgres/update.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 lib/postgres/update.sh diff --git a/lib/postgres/update.sh b/lib/postgres/update.sh new file mode 100755 index 00000000..391d861e --- /dev/null +++ b/lib/postgres/update.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -e +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 + +#. /etc/profile -- 2.47.3