Search Postgresql Archives

Re: recommended schema diff tools?

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

 



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.




--
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