1 |
2092
|
aaronmk
|
#!/bin/sh
|
2 |
|
|
# Dumps a schema of the vegbien db
|
3 |
|
|
|
4 |
|
|
selfDir="$(dirname -- "$0")"
|
5 |
|
|
|
6 |
|
|
if ! test "$#" -eq 1; then
|
7 |
3361
|
aaronmk
|
echo "Usage: env [data=1] [owners=1] $0 schema >schema.sql"
|
8 |
2092
|
aaronmk
|
exit 2
|
9 |
|
|
fi
|
10 |
3361
|
aaronmk
|
test -n "$data" && dataOpts='--format=c --compress=9' || dataOpts=--schema-only
|
11 |
2622
|
aaronmk
|
test -n "$owners" && noOwners= || noOwners=1
|
12 |
2092
|
aaronmk
|
|
13 |
3251
|
aaronmk
|
(set -x; "$selfDir/../bin/postgres_vegbien" pg_dump --schema="\"$1\"" \
|
14 |
3361
|
aaronmk
|
$dataOpts${noOwners:+ --no-owner --no-privileges})
|