Re: source control integration - Mailing list pgsql-general

From Greg Stark
Subject Re: source control integration
Date
Msg-id 87d5xo2h1i.fsf@stark.xeocode.com
Whole thread Raw
In response to source control integration  (Simon Wittber <simonwittber@gmail.com>)
List pgsql-general
Simon Wittber <simonwittber@gmail.com> writes:

> What is currently regarded as postgresql best-practice for controlling
> changes to a database?
>
> I currently administer SQL Server. I implemented a system which
> scripts every database object each hour (into a SQL script on the
> filesystem), and then uses SVN to track changes and email me if a
> change has occured, which then gives me the opportunity to review and
> commit the change.
>
> Is this sort of thing possible with postgresql?

Look at pg_dump -s. I do something similar though I only pull the data on
demand and check it in manually with a commit message.

With 7.4 you get spurious changes that you have to strip out. My makefile
entry for 7.4 is:

schema.sql:
    pg_dump -U postgres -s db | sed '/^-- TOC entry/d;/^\\connect - postgres/,/^\\connect - db/d;/^SET
search_path/d;/^$$/d;/^--$$/d'> $@ 

I think the 8.0 pg_dump has removed the extraneous information.

--
greg

pgsql-general by date:

Previous
From: "Guy Rouillier"
Date:
Subject: Re: Select distinct sorting all rows 8.0rc1
Next
From: Greg Stark
Date:
Subject: Re: When to encrypt