Hush schema build messages that obscure potential real problems
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 31 Jul 2008 13:10:18 +0000 (13:10 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 31 Jul 2008 13:10:18 +0000 (13:10 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10216 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/sql/Pg/build-db.sh

index 67c3b12..9ad12ee 100755 (executable)
@@ -2,13 +2,14 @@
 
 # ---------------------------------------------------------------------------
 # Store command line args for later use
-# args: {db-host} {db-port} {db-name} {db-user} {db-password}
+# args: {db-host} {db-port} {db-name} {db-user} {db-password} {verbose}
 # ---------------------------------------------------------------------------
 PGHOST=$1
 PGPORT=$2
 PGDATABASE=$3
 PGUSER=$4
 PGPASSWORD=$5
+VERBOSE=$6
 export PGHOST PGPORT PGDATABASE PGUSER PGPASSWORD
 
 # ---------------------------------------------------------------------------
@@ -128,7 +129,12 @@ for sql_file in $ordered_file_list; do
   # export ON_ERROR_STOP=1
 
   export PGHOST PGPORT PGDATABASE PGUSER PGPASSWORD
-  psql -f $sql_file
+  # Hide most of the harmless messages that obscure real problems
+  if [ -z "$VERBOSE" ]; then
+    psql -f $sql_file 2>&1 | grep -v NOTICE | grep -v "^INSERT"
+  else
+    psql -f $sql_file
+  fi
   if [ $? != 0 ]; then
     cat <<EOM
 ********************************************************************************