[CalendarServer-changes] [11852] CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/ oracle-dialect/upgrade_from_19_to_20.sql

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:21:09 PDT 2014


Revision: 11852
          http://trac.calendarserver.org//changeset/11852
Author:   cdaboo at apple.com
Date:     2013-10-30 13:50:32 -0700 (Wed, 30 Oct 2013)
Log Message:
-----------
Fix issue with upgrade when address books are present.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_19_to_20.sql

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_19_to_20.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_19_to_20.sql	2013-10-30 20:43:02 UTC (rev 11851)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_19_to_20.sql	2013-10-30 20:50:32 UTC (rev 11852)
@@ -113,8 +113,12 @@
 -- Alter  ADDRESSBOOK_HOME --
 -----------------------------
 
+-- This is tricky as we have to create a new not null column and populate it, but we can't do
+-- not null immediately without a default - which we do not want. So we create the column without not null,
+-- do the updates, then add the constraint.
+
 alter table ADDRESSBOOK_HOME
-	add ("ADDRESSBOOK_PROPERTY_STORE_ID" integer not null);
+	add ("ADDRESSBOOK_PROPERTY_STORE_ID" integer);
 
 update ADDRESSBOOK_HOME
 	set	ADDRESSBOOK_PROPERTY_STORE_ID = (
@@ -133,8 +137,11 @@
 			ADDRESSBOOK_BIND.BIND_MODE = 0 and 	-- CALENDAR_BIND_MODE 'own'
 			ADDRESSBOOK_BIND.ADDRESSBOOK_RESOURCE_NAME = 'addressbook'
   	);
-	
 
+alter table ADDRESSBOOK_HOME
+	modify ("ADDRESSBOOK_PROPERTY_STORE_ID" not null);
+
+
 --------------------------------
 -- change  ADDRESSBOOK_OBJECT --
 --------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/87635e97/attachment.html>


More information about the calendarserver-changes mailing list