Re: db schema diff - Mailing list pgsql-general

From
Subject Re: db schema diff
Date
Msg-id 64719.216.238.112.88.1081798687.squirrel@$HOSTNAME
Whole thread Raw
In response to db schema diff  (Igor Shevchenko <igor@carcass.ath.cx>)
Responses Re: db schema diff
List pgsql-general
> Suppose I have "pg_dump -s" of two pg installs, one is "dev", another
> is  "production". Their schemas don't differ too much, and I want to
> get a "diff  -u"-like schema diff so I can quickly add missing/remove
> old
> tables/sequences/etc to one or another (manually). Is there some quick
> tool  for doing this ?
>
> There was a thread about it sometime in aug, 2002, but it ended without
>  producing anything useful.

This is the closest I get, but it is only marginally useful:

--File: pg_compare --------------------------------------
#!/bin/bash
# Script to dump a PostgreSQL database schema for two databases
# and compare them.
# Author: Berend M. Tober <btober@computer dot org>
# Date:   August 25, 2003

PG_DUMP=/usr/bin/pg_dump
DIFF=/usr/bin/diff
GREP=/bin/grep
CAT=/bin/cat

-- 5434 is the port on which DEV runs
-- 5433 is the port on which QAT runs

${PG_DUMP} -s -p 5432 mydb|${GREP} -v '^--'|${CAT} -s >5432.sql
${PG_DUMP} -s -p 5433 mydb|${GREP} -v '^--'|${CAT} -s >5433.sql
${PG_DUMP} -s -p 5434 mydb|${GREP} -v '^--'|${CAT} -s >5434.sql

${DIFF} 5432.sql 5433.sql > 5432-5433.diff
${DIFF} 5433.sql 5434.sql > 5433-5434.diff


~Berend Tober




pgsql-general by date:

Previous
From: Clodoaldo Pinto Neto
Date:
Subject: Re: COPY TO order
Next
From: Igor Shevchenko
Date:
Subject: Re: db schema diff