liquid_feedback_core

view lf_export @ 97:58451b5565ae

Introduced (organizational) units

- New table "unit"
- Each "area" refers to one unit
- "invite_code"s are valid for one or many units
- New table "privilege" stores "voting_right" for units
- Delegation scope 'global' is replaced by delegation scope 'unit'
- View "global_delegation" is replaced by "unit_delegation"
- Removed helper view "active_delegation"
- Checking that members have "voting_right" in several views and functions
- New view "unit_member_count" to update "member_count" column of new unit table
- New argument list for function "delegation_chain"(...) containing "unit_id"
- Renamed column "member_active" to "member_valid" in "delegation_chain_row"
- Modified demo.sql and init.sql to support units
author jbe
date Tue Dec 07 00:04:44 2010 +0100 (2010-12-07)
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