[patch] pgsql upgrade 2.3.3 -> 2.4.0

Boris Samorodov bsam at ipt.ru
Thu Jun 28 18:44:01 EDT 2007


Hi!


Upgrading via upgrade.sh from 2.3.3 to 2.4.0 for pgsql was not a
success. Investigating shows that some changes to the file
mig_pgsql_tinderbox-2.3.3_to_2.4.0.sql should be done:
-----
--- mig_pgsql_tinderbox-2.3.3_to_2.4.0.sql.orig 2007-06-29 02:35:56.000000000 +0400
+++ mig_pgsql_tinderbox-2.3.3_to_2.4.0.sql      2007-06-29 02:36:46.000000000 +0400
@@ -1,7 +1,7 @@
 CREATE TABLE hooks (
     Hook_Name VARCHAR(32) NOT NULL PRIMARY KEY,
     Hook_Cmd VARCHAR(255),
-    Hook_Description TEXT,
+    Hook_Description TEXT
 );
 
 INSERT INTO hooks VALUES ('prePortsTreeUpdate', NULL, 'Hook to run prior to updating a PortsTree.\nIf this hook returns a non-zero value, the PortsTree will not be updated.\nThe following environment will be passed to the hook command:\n\tPORTSTREE : PortsTree name\n\tUPDATE_CMD : Update command\n\tPB : Tinderbox root');
@@ -21,6 +21,7 @@
   ADD COLUMN Last_Failed_Dependency VARCHAR(255),
   ADD COLUMN Last_Run_Duration INTEGER,
   ADD COLUMN Currently_Building INTEGER NOT NULL DEFAULT 0,
-  ALTER COLUMN Last_Status TYPE VARCHAR(16) CHECK (Last_Status IN ('UNKNOWN','SUCCESS','FAIL','BROKEN','LEFTOVERS','DUD','DEPEND')) DEFAULT 'UNKNOWN';
+  DROP COLUMN Last_Status,
+  ADD COLUMN Last_Status VARCHAR(16) CHECK (Last_Status IN ('UNKNOWN','SUCCESS','FAIL','BROKEN','LEFTOVERS','DUD','DEPEND')) DEFAULT 'UNKNOWN';
 
 UPDATE config SET Config_Option_Value='2.4.0' WHERE Config_Option_Name='__DSVERSION__';
-----

1. Fix a typo (delete unneeded ",").
2. This one was not as easy as the first one. Seems that PostgerSQL (at
   least since 7.3) does not have a feature to alter a column
   constraint. Hence I deletted one and recreate it. Yes, the history
   had been deletted. Another way is to use a new constraint...


WBR
-- 
Boris Samorodov (bsam)
Research Engineer, http://www.ipt.ru Telephone & Internet SP
FreeBSD committer, http://www.FreeBSD.org The Power To Serve


More information about the tinderbox-list mailing list