Utilitka pro diff zaloh databaze (i vuci aktualni)
This commit is contained in:
parent
301c2e967e
commit
51f3b22f09
1 changed files with 28 additions and 0 deletions
28
diff_db_backup.sh
Executable file
28
diff_db_backup.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
DBNAME=mam-prod
|
||||
F1="$1"
|
||||
F2="$2"
|
||||
TMPF1=`tempfile`
|
||||
TMPF2=`tempfile`
|
||||
|
||||
if [ "z$F1" == "z" ]; then
|
||||
echo "Requies argument"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat "$F1" | bunzip2 > "$TMPF1"
|
||||
|
||||
if [ "z$F2" == "z" ]; then
|
||||
echo "Diff from $F1 to current DB:"
|
||||
pg_dump $DBNAME -U mam >"$TMPF2"
|
||||
else
|
||||
echo "Diff from $F1 to $F2:"
|
||||
cat "$F2" | bunzip2 > "$TMPF2"
|
||||
fi
|
||||
|
||||
colordiff "$TMPF1" "$TMPF2"
|
||||
|
||||
rm "$TMPF1" "$TMPF2"
|
||||
|
||||
|
Loading…
Reference in a new issue