Search Postgresql Archives

Re: Schema Upgrade Howto

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I found a way to do it. One problem remains: The order of the columns
can't be changed.
Any change to make postgres support this in the future?

My way:

pg_dump -s prod  | strip-schema-dump.py - > prod.schema
pg_dump -s devel | strip-schema-dump.py - > devel.schema

strip-schema-dump.py removes some stuff which I don't care about (Owner, Comments, ...)

kdiff3 prod.schema devel.schema

You need to create an upgrade script by looking at the diff. 
But it is not difficult:

-- update-YYYY-MM-DD.sql
begin;
alter table ... add column ...;
...
commit;

Execute on production:
cat update-YYYY-MM-DD.sql | psql 

See http://www.djangosnippets.org/snippets/1160/


David Fetter schrieb:
> On Thu, Oct 30, 2008 at 10:54:46AM +0100, Thomas Guettler wrote:
>   
>> Hi,
>>
>> is there a schema upgrade howto? I could not find much with google.
>>
>> There is a running DB and a development DB. The development DB
>> has some tables, columns and indexes added.
>>     
>
> The only sure way to track such changes is by changing the
> databases--especially in development--only via scripts, all of which
> go into your source code management system.
>
>   


-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux