f8a89cc6 by Adam Heath

Add beginning of upload support to exporting.

1 parent 1cd3bc42
......@@ -7,8 +7,26 @@ chmod 0600 /tmp/pgpass
echo "*:*:*:*:CHANGEME" > /tmp/pgpass
export PGPASSFILE=/tmp/pgpass
_pgdump() {
pg_dump -w -h ${POSTGRESQL_HOST} -U postgres "$1"
}
ls /workspace
for database in "$@"; do
pg_dump -w -h ${POSTGRESQL_HOST} -U postgres "$database" | gzip -9v > "/workspace/exports/$database.gz"
for item in "$@"; do
target="${item%%:*}"
remote="${item#*:}"
case "$target" in
(*.sql.gz)
database="$(basename "$file" .sql.gz)"
_pgdump "$database" | gzip -9v > "/workspace/exports/$database.sql.gz"
;;
(*.sql)
database="$(basename "$file" .sql)"
_pgdump "$database" > "/workspace/exports/$database.sql"
;;
(*)
_pgdump "$item" > "/workspace/exports/$item.sql"
;;
esac
done
......