initial commit
[public/postgresql-toys.git] / comparepgsqldb
1 #!/bin/bash
2 # Postgresql schema comparer
3 # Copyright 2007 Svenne Krap
4 # Released under ASL 2.0
5
6 if [ $# -ne 2 ]; then
7     echo "DB compare <db1> <db2>"
8     exit
9 fi
10 DB1=$1
11 DB2=$2
12 File1=`mktemp`
13 File2=`mktemp`
14 echo "Compare PostgreSQL database $DB1 and $DB2"
15 echo "No lines below this means database structure is equal. Data is not checked."
16 pg_dump --schema-only $DB1 > $File1
17 pg_dump --schema-only $DB2  > $File2
18 diff -u $File1 $File2
19 rm $File1
20 rm $File2
21