From: | Thomas Guettler <hv(at)tbz-pariv(dot)de> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Schema Upgrade Howto |
Date: | 2008-10-30 13:37:43 |
Message-ID: | 4909B8A7.7080709@tbz-pariv.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Nikolas Everett | 2008-10-30 13:40:59 | Re: excluding tables from VACUUM ANALYZE |
Previous Message | Teodor Sigaev | 2008-10-30 13:37:40 | Re: Weird problem concerning tsearch functions built into postgres 8.3, assistance requested |