liquid_feedback_core

view lf_export @ 485:e431f1b73c35

Fixed further mistake in views "updated_initiative" and "updated_or_featured_initiative"
author jbe
date Fri Apr 01 17:30:08 2016 +0200 (2016-04-01)
parents 2b03946cb0c2
children
line source
1 #!/bin/sh
3 if [ -z "$1" -o -z "$2" ]; then
4 echo "Usage: $0 <dbname> <filename>.sql.gz"
5 exit 1
6 fi
8 EXPORT_DBNAME=liquid_feedback_autoexport
9 retval=0
11 echo "Dropping database \"$EXPORT_DBNAME\" if existent..."
12 dropdb "$EXPORT_DBNAME" 2> /dev/null
13 echo "Copying database \"$1\" to new database \"$EXPORT_DBNAME\"..."
14 # TODO: use character encoding of original database
15 if (createdb "$EXPORT_DBNAME" && pg_dump "$1" | psql -f - "$EXPORT_DBNAME" > /dev/null)
16 then
17 echo "Deleting private data in copied database..."
18 if psql -v ON_ERROR_STOP=1 -c 'SELECT delete_private_data()' "$EXPORT_DBNAME" > /dev/null
19 then
20 echo "Dumping and compressing copied database to \"$2\"..."
21 if pg_dump --no-owner --no-privileges "$EXPORT_DBNAME" | gzip -9 > "$2"
22 then
23 true
24 else
25 retval=4
26 fi
27 else
28 retval=3
29 fi
30 else
31 retval=2
32 fi
33 echo "Dropping database \"$EXPORT_DBNAME\"..."
34 dropdb "$EXPORT_DBNAME"
35 echo "DONE."
36 exit $retval

Impressum / About Us