Re: recommended schema diff tools?

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: recommended schema diff tools?
Date: 2012-04-12 16:02:01
Message-ID: jm6u9n$qvt$1@dough.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Chris Angelico wrote on 12.04.2012 17:10:
> patchlevel = query("select patchlevel from config")
> switch (patchlevel)
> {
> default: print("Unknown patch level!"); break;
> case 1:
> print("20120216: Adding Foobar columns to Quux")
> query("ALTER TABLE Quux ADD foo smallint not null default 0, ADD
> bar varchar")
> case 2:
> ... etc ...
> case 42:
> ...
> // Add new patch levels here
> query("update config set patchlevel=43"); query("commit");
> case 43: break;
> }
>
>
> Every change is thus assigned a number. The current patch level is a
> safe no-op; any unrecognized number is a major error. The script is
> thus safe to run on any database, and will always bring that database
> up to the script's current patch level.

Sounds like you implement something very similar to Liquibase.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2012-04-12 16:05:33 Re: recommended schema diff tools?
Previous Message Chris Angelico 2012-04-12 15:39:35 Re: recommended schema diff tools?