Thread: source control integration

source control integration

From
Simon Wittber
Date:
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?

Sw.

Re: source control integration

From
Greg Stark
Date:
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