liquid_feedback_core
annotate lf_export @ 128:5ea2f9c5ba9a
Set "rank" for all "admitted" initiatives after voting is finished; Additional columns in "initiative" table store voting result information
Changes in detail:
- Renamed column "majority" of table "initiative" to "attainable"
- Added columns "favored", "unfavored" and "eligible" to "initiative" table
- Added constraints to "initiative" table, restricting certain value combinations in the the new columns
- Modified "calculate_ranks" function to update the new columns and always write "rank" information
- Marking the final winner is now done utilizing the new "eligible" column
Changes in detail:
- Renamed column "majority" of table "initiative" to "attainable"
- Added columns "favored", "unfavored" and "eligible" to "initiative" table
- Added constraints to "initiative" table, restricting certain value combinations in the the new columns
- Modified "calculate_ranks" function to update the new columns and always write "rank" information
- Marking the final winner is now done utilizing the new "eligible" column
author | jbe |
---|---|
date | Tue May 24 14:58:42 2011 +0200 (2011-05-24) |
parents | 2b03946cb0c2 |
children |
rev | line source |
---|---|
jbe@8 | 1 #!/bin/sh |
jbe@8 | 2 |
jbe@8 | 3 if [ -z "$1" -o -z "$2" ]; then |
jbe@8 | 4 echo "Usage: $0 <dbname> <filename>.sql.gz" |
jbe@8 | 5 exit 1 |
jbe@8 | 6 fi |
jbe@8 | 7 |
jbe@8 | 8 EXPORT_DBNAME=liquid_feedback_autoexport |
jbe@8 | 9 retval=0 |
jbe@8 | 10 |
jbe@8 | 11 echo "Dropping database \"$EXPORT_DBNAME\" if existent..." |
jbe@8 | 12 dropdb "$EXPORT_DBNAME" 2> /dev/null |
jbe@8 | 13 echo "Copying database \"$1\" to new database \"$EXPORT_DBNAME\"..." |
jbe@40 | 14 # TODO: use character encoding of original database |
jbe@40 | 15 if (createdb "$EXPORT_DBNAME" && pg_dump "$1" | psql -f - "$EXPORT_DBNAME" > /dev/null) |
jbe@8 | 16 then |
jbe@8 | 17 echo "Deleting private data in copied database..." |
jbe@9 | 18 if psql -v ON_ERROR_STOP=1 -c 'SELECT delete_private_data()' "$EXPORT_DBNAME" > /dev/null |
jbe@8 | 19 then |
jbe@8 | 20 echo "Dumping and compressing copied database to \"$2\"..." |
jbe@8 | 21 if pg_dump --no-owner --no-privileges "$EXPORT_DBNAME" | gzip -9 > "$2" |
jbe@8 | 22 then |
jbe@11 | 23 true |
jbe@8 | 24 else |
jbe@8 | 25 retval=4 |
jbe@8 | 26 fi |
jbe@8 | 27 else |
jbe@8 | 28 retval=3 |
jbe@8 | 29 fi |
jbe@8 | 30 else |
jbe@8 | 31 retval=2 |
jbe@8 | 32 fi |
jbe@8 | 33 echo "Dropping database \"$EXPORT_DBNAME\"..." |
jbe@8 | 34 dropdb "$EXPORT_DBNAME" |
jbe@8 | 35 echo "DONE." |
jbe@8 | 36 exit $retval |