f8a89cc6 by Adam Heath

Add beginning of upload support to exporting.

1 parent 1cd3bc42
...@@ -7,8 +7,26 @@ chmod 0600 /tmp/pgpass ...@@ -7,8 +7,26 @@ chmod 0600 /tmp/pgpass
7 echo "*:*:*:*:CHANGEME" > /tmp/pgpass 7 echo "*:*:*:*:CHANGEME" > /tmp/pgpass
8 export PGPASSFILE=/tmp/pgpass 8 export PGPASSFILE=/tmp/pgpass
9 9
10 _pgdump() {
11 pg_dump -w -h ${POSTGRESQL_HOST} -U postgres "$1"
12 }
13
10 ls /workspace 14 ls /workspace
11 for database in "$@"; do 15 for item in "$@"; do
12 pg_dump -w -h ${POSTGRESQL_HOST} -U postgres "$database" | gzip -9v > "/workspace/exports/$database.gz" 16 target="${item%%:*}"
17 remote="${item#*:}"
18 case "$target" in
19 (*.sql.gz)
20 database="$(basename "$file" .sql.gz)"
21 _pgdump "$database" | gzip -9v > "/workspace/exports/$database.sql.gz"
22 ;;
23 (*.sql)
24 database="$(basename "$file" .sql)"
25 _pgdump "$database" > "/workspace/exports/$database.sql"
26 ;;
27 (*)
28 _pgdump "$item" > "/workspace/exports/$item.sql"
29 ;;
30 esac
13 done 31 done
14 32
......