Commit d6da2fd8 authored by Michał 'rysiek' Woźniak's avatar Michał 'rysiek' Woźniak
Browse files

grants before schema in postgres dump

parent abac4d8b
......@@ -440,10 +440,8 @@ function dump_postgres_dbs {
echo " +-- schema file : $SCHEMA_FILE"
echo " +-- dump file : $DUMP_FILE"
# schema
echo " +-- schema..."
PGPASSWORD="$3" pg_dump -h "$1" --create --clean --schema-only -U "$2" "$db" > "$SCHEMA_FILE"
[ $? -eq 0 ] || display_error_and_continue
# clear the schema file
echo > "$SCHEMA_FILE"
# grants
echo " +-- grants..."
......@@ -455,6 +453,15 @@ function dump_postgres_dbs {
USERS_GREP="$( echo $USERS_GREP | tr ' ' '|' )"
echo "$DBUSERS" | egrep " ($USERS_GREP)[; ]" >> "$SCHEMA_FILE"
# schema
echo " +-- schema..."
echo '-- ------ --' >> "$SCHEMA_FILE"
echo '-- SCHEMA --' >> "$SCHEMA_FILE"
echo '-- ------ --' >> "$SCHEMA_FILE"
PGPASSWORD="$3" pg_dump -h "$1" --create --clean --schema-only -U "$2" "$db" >> "$SCHEMA_FILE"
[ $? -eq 0 ] || display_error_and_continue
# dump
echo " +-- dump..."
PGPASSWORD="$3" pg_dump -h "$1" --format plain --compress 9 -U "$2" "$db" > "$DUMP_FILE"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment