liquid_feedback_core

view lf_export @ 27:77ac81cbe5c0

SQL update script from beta18: Changed destination version from v1.0.0 to beta19
(fixes mistake in changeset 66971fefaba2)
author jbe
date Sat Feb 06 03:59:03 2010 +0100 (2010-02-06)
parents 015825e225ca
children 2b03946cb0c2
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 if createdb -T "$1" "$EXPORT_DBNAME"
15 then
16 echo "Deleting private data in copied database..."
17 if psql -v ON_ERROR_STOP=1 -c 'SELECT delete_private_data()' "$EXPORT_DBNAME" > /dev/null
18 then
19 echo "Dumping and compressing copied database to \"$2\"..."
20 if pg_dump --no-owner --no-privileges "$EXPORT_DBNAME" | gzip -9 > "$2"
21 then
22 true
23 else
24 retval=4
25 fi
26 else
27 retval=3
28 fi
29 else
30 retval=2
31 fi
32 echo "Dropping database \"$EXPORT_DBNAME\"..."
33 dropdb "$EXPORT_DBNAME"
34 echo "DONE."
35 exit $retval

Impressum / About Us