Re: Version Control Software for Database Objects - Mailing list pgsql-general

From Tim Allen
Subject Re: Version Control Software for Database Objects
Date
Msg-id 41E72942.9060807@proximity.com.au
Whole thread Raw
In response to Version Control Software for Database Objects  ("Mark Dexter" <MDEXTER@dexterchaney.com>)
Responses Re: Version Control Software for Database Objects
List pgsql-general
Mark Dexter wrote:
> We maintain multiple versions of our application's database and we are
> looking for version control software to help us automate this.
> Specifically, we would like to have a program that automatically tracks
> all changes to the database (tables, views, functions, etc.) and assists
> with updating customers' databases from one version to the next.
>
> Does anyone know of such a program that works with PostgreSQL?  Thanks
> for your help.

Assuming you mean version control of the _schema_, rather than the data
therein, then no, I don't know of any such program available. However,
it's not too hard to do it yourself, which is what we've done. Create a
table which has only one row, containing a schema version number, and
build some constant into your application which has the same number -
the application should check the database schema number on startup and
complain loudly if the two don't match. Every time you release a new
version of the application that has a schema change, then both increment
the schema number and write a script that will perform the schema update
from version n to version n + 1. If you name your scripts in a
consistent way, it's not hard to then write a script that compares the
current schema version at a site with that expected by the new
application version, and incrementally runs each update script.

Tim

--
-----------------------------------------------
Tim Allen          tim@proximity.com.au
Proximity Pty Ltd  http://www.proximity.com.au/
   http://www4.tpg.com.au/users/rita_tim/

pgsql-general by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Version Control Software for Database Objects
Next
From: Greg Stark
Date:
Subject: Re: best place to enfore rules