[CalendarServer-changes] [12232] CalendarServer/trunk/txdav/common/datastore/sql_schema

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


Revision: 12232
          http://trac.calendarserver.org//changeset/12232
Author:   cdaboo at apple.com
Date:     2014-01-03 12:06:54 -0800 (Fri, 03 Jan 2014)
Log Message:
-----------
Back port the previous sql index addition to an early DB version to match that on an active branch.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v27.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v28.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v29.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v30.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v31.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v27.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v28.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v29.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v30.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v31.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_26_to_27.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_27_to_28.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_28_to_29.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_29_to_30.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_30_to_31.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_31_to_32.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_26_to_27.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_27_to_28.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_28_to_29.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_29_to_30.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_30_to_31.sql
    CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_31_to_32.sql

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v27.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v27.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v27.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -30,7 +30,6 @@
     "QUOTA_USED_BYTES" integer default 0 not null,
     "DEFAULT_EVENTS" integer default null references CALENDAR on delete set null,
     "DEFAULT_TASKS" integer default null references CALENDAR on delete set null,
-    "DEFAULT_POLLS" integer default null references CALENDAR on delete set null,
     "ALARM_VEVENT_TIMED" nclob default null,
     "ALARM_VEVENT_ALLDAY" nclob default null,
     "ALARM_VTODO_TIMED" nclob default null,
@@ -377,10 +376,6 @@
     DEFAULT_TASKS
 );
 
-create index CALENDAR_HOME_METADAT_910264ce on CALENDAR_HOME_METADATA (
-    DEFAULT_POLLS
-);
-
 create index NOTIFICATION_NOTIFICA_f891f5f9 on NOTIFICATION (
     NOTIFICATION_HOME_RESOURCE_ID
 );
@@ -423,6 +418,10 @@
     CALENDAR_HOME_RESOURCE_ID
 );
 
+create index ATTACHMENT_DROPBOX_ID_5073cf23 on ATTACHMENT (
+    DROPBOX_ID
+);
+
 create index ATTACHMENT_CALENDAR_O_81508484 on ATTACHMENT_CALENDAR_OBJECT (
     CALENDAR_OBJECT_RESOURCE_ID
 );

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v28.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v28.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v28.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -347,8 +347,7 @@
 create table PUSH_NOTIFICATION_WORK (
     "WORK_ID" integer primary key not null,
     "NOT_BEFORE" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
-    "PUSH_ID" nvarchar2(255),
-    "PRIORITY" integer not null
+    "PUSH_ID" nvarchar2(255)
 );
 
 create table GROUP_CACHER_POLLING_WORK (
@@ -424,6 +423,10 @@
     CALENDAR_HOME_RESOURCE_ID
 );
 
+create index ATTACHMENT_DROPBOX_ID_5073cf23 on ATTACHMENT (
+    DROPBOX_ID
+);
+
 create index ATTACHMENT_CALENDAR_O_81508484 on ATTACHMENT_CALENDAR_OBJECT (
     CALENDAR_OBJECT_RESOURCE_ID
 );

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v29.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v29.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v29.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -49,16 +49,15 @@
 
 create table NOTIFICATION_HOME (
     "RESOURCE_ID" integer primary key,
-    "OWNER_UID" nvarchar2(255) unique,
-    "DATAVERSION" integer default 0 not null
+    "OWNER_UID" nvarchar2(255) unique
 );
 
 create table NOTIFICATION (
     "RESOURCE_ID" integer primary key,
     "NOTIFICATION_HOME_RESOURCE_ID" integer not null references NOTIFICATION_HOME,
     "NOTIFICATION_UID" nvarchar2(255),
-    "NOTIFICATION_TYPE" nvarchar2(255),
-    "NOTIFICATION_DATA" nclob,
+    "XML_TYPE" nvarchar2(255),
+    "XML_DATA" nclob,
     "MD5" nchar(32),
     "CREATED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC',
     "MODIFIED" timestamp default CURRENT_TIMESTAMP at time zone 'UTC', 
@@ -92,7 +91,6 @@
 insert into CALENDAR_BIND_MODE (DESCRIPTION, ID) values ('read', 1);
 insert into CALENDAR_BIND_MODE (DESCRIPTION, ID) values ('write', 2);
 insert into CALENDAR_BIND_MODE (DESCRIPTION, ID) values ('direct', 3);
-insert into CALENDAR_BIND_MODE (DESCRIPTION, ID) values ('indirect', 4);
 create table CALENDAR_BIND_STATUS (
     "ID" integer primary key,
     "DESCRIPTION" nvarchar2(16) unique
@@ -102,7 +100,6 @@
 insert into CALENDAR_BIND_STATUS (DESCRIPTION, ID) values ('accepted', 1);
 insert into CALENDAR_BIND_STATUS (DESCRIPTION, ID) values ('declined', 2);
 insert into CALENDAR_BIND_STATUS (DESCRIPTION, ID) values ('invalid', 3);
-insert into CALENDAR_BIND_STATUS (DESCRIPTION, ID) values ('deleted', 4);
 create table CALENDAR_TRANSP (
     "ID" integer primary key,
     "DESCRIPTION" nvarchar2(16) unique
@@ -373,7 +370,6 @@
 insert into CALENDARSERVER (NAME, VALUE) values ('VERSION', '29');
 insert into CALENDARSERVER (NAME, VALUE) values ('CALENDAR-DATAVERSION', '5');
 insert into CALENDARSERVER (NAME, VALUE) values ('ADDRESSBOOK-DATAVERSION', '2');
-insert into CALENDARSERVER (NAME, VALUE) values ('NOTIFICATION-DATAVERSION', '1');
 create index CALENDAR_HOME_METADAT_3cb9049e on CALENDAR_HOME_METADATA (
     DEFAULT_EVENTS
 );
@@ -428,6 +424,10 @@
     CALENDAR_HOME_RESOURCE_ID
 );
 
+create index ATTACHMENT_DROPBOX_ID_5073cf23 on ATTACHMENT (
+    DROPBOX_ID
+);
+
 create index ATTACHMENT_CALENDAR_O_81508484 on ATTACHMENT_CALENDAR_OBJECT (
     CALENDAR_OBJECT_RESOURCE_ID
 );

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v30.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v30.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v30.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -256,12 +256,10 @@
 insert into ADDRESSBOOK_OBJECT_KIND (DESCRIPTION, ID) values ('resource', 2);
 insert into ADDRESSBOOK_OBJECT_KIND (DESCRIPTION, ID) values ('location', 3);
 create table ABO_MEMBERS (
-    "GROUP_ID" integer not null,
+    "GROUP_ID" integer not null references ADDRESSBOOK_OBJECT on delete cascade,
     "ADDRESSBOOK_ID" integer not null references ADDRESSBOOK_HOME on delete cascade,
-    "MEMBER_ID" integer not null,
-    "REVISION" integer not null,
-    "REMOVED" integer default 0 not null, 
-    primary key("GROUP_ID", "MEMBER_ID", "REVISION")
+    "MEMBER_ID" integer not null references ADDRESSBOOK_OBJECT, 
+    primary key("GROUP_ID", "MEMBER_ID")
 );
 
 create table ABO_FOREIGN_MEMBERS (
@@ -296,7 +294,6 @@
     "ADDRESSBOOK_HOME_RESOURCE_ID" integer not null references ADDRESSBOOK_HOME,
     "OWNER_HOME_RESOURCE_ID" integer references ADDRESSBOOK_HOME,
     "ADDRESSBOOK_NAME" nvarchar2(255) default null,
-    "OBJECT_RESOURCE_ID" integer default 0,
     "RESOURCE_NAME" nvarchar2(255),
     "REVISION" integer not null,
     "DELETED" integer not null
@@ -431,6 +428,10 @@
     CALENDAR_HOME_RESOURCE_ID
 );
 
+create index ATTACHMENT_DROPBOX_ID_5073cf23 on ATTACHMENT (
+    DROPBOX_ID
+);
+
 create index ATTACHMENT_CALENDAR_O_81508484 on ATTACHMENT_CALENDAR_OBJECT (
     CALENDAR_OBJECT_RESOURCE_ID
 );

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v31.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v31.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/old/oracle-dialect/v31.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -18,17 +18,9 @@
 create table CALENDAR_HOME (
     "RESOURCE_ID" integer primary key,
     "OWNER_UID" nvarchar2(255) unique,
-    "STATUS" integer default 0 not null,
     "DATAVERSION" integer default 0 not null
 );
 
-create table HOME_STATUS (
-    "ID" integer primary key,
-    "DESCRIPTION" nvarchar2(16) unique
-);
-
-insert into HOME_STATUS (DESCRIPTION, ID) values ('normal', 0);
-insert into HOME_STATUS (DESCRIPTION, ID) values ('external', 1);
 create table CALENDAR (
     "RESOURCE_ID" integer primary key
 );
@@ -58,7 +50,6 @@
 create table NOTIFICATION_HOME (
     "RESOURCE_ID" integer primary key,
     "OWNER_UID" nvarchar2(255) unique,
-    "STATUS" integer default 0 not null,
     "DATAVERSION" integer default 0 not null
 );
 
@@ -77,7 +68,6 @@
 create table CALENDAR_BIND (
     "CALENDAR_HOME_RESOURCE_ID" integer not null references CALENDAR_HOME,
     "CALENDAR_RESOURCE_ID" integer not null references CALENDAR on delete cascade,
-    "EXTERNAL_ID" integer default null,
     "CALENDAR_RESOURCE_NAME" nvarchar2(255),
     "BIND_MODE" integer not null,
     "BIND_STATUS" integer not null,
@@ -220,7 +210,6 @@
     "RESOURCE_ID" integer primary key,
     "ADDRESSBOOK_PROPERTY_STORE_ID" integer not null,
     "OWNER_UID" nvarchar2(255) unique,
-    "STATUS" integer default 0 not null,
     "DATAVERSION" integer default 0 not null
 );
 
@@ -234,7 +223,6 @@
 create table SHARED_ADDRESSBOOK_BIND (
     "ADDRESSBOOK_HOME_RESOURCE_ID" integer not null references ADDRESSBOOK_HOME,
     "OWNER_HOME_RESOURCE_ID" integer not null references ADDRESSBOOK_HOME on delete cascade,
-    "EXTERNAL_ID" integer default null,
     "ADDRESSBOOK_RESOURCE_NAME" nvarchar2(255),
     "BIND_MODE" integer not null,
     "BIND_STATUS" integer not null,
@@ -286,7 +274,6 @@
 create table SHARED_GROUP_BIND (
     "ADDRESSBOOK_HOME_RESOURCE_ID" integer not null references ADDRESSBOOK_HOME,
     "GROUP_RESOURCE_ID" integer not null references ADDRESSBOOK_OBJECT on delete cascade,
-    "EXTERNAL_ID" integer default null,
     "GROUP_ADDRESSBOOK_NAME" nvarchar2(255),
     "BIND_MODE" integer not null,
     "BIND_STATUS" integer not null,
@@ -444,6 +431,10 @@
     CALENDAR_HOME_RESOURCE_ID
 );
 
+create index ATTACHMENT_DROPBOX_ID_5073cf23 on ATTACHMENT (
+    DROPBOX_ID
+);
+
 create index ATTACHMENT_CALENDAR_O_81508484 on ATTACHMENT_CALENDAR_OBJECT (
     CALENDAR_OBJECT_RESOURCE_ID
 );

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v27.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v27.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v27.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -74,7 +74,6 @@
   QUOTA_USED_BYTES         integer     default 0 not null,
   DEFAULT_EVENTS           integer     default null references CALENDAR on delete set null,
   DEFAULT_TASKS            integer     default null references CALENDAR on delete set null,
-  DEFAULT_POLLS            integer     default null references CALENDAR on delete set null,
   ALARM_VEVENT_TIMED       text        default null,
   ALARM_VEVENT_ALLDAY      text        default null,
   ALARM_VTODO_TIMED        text        default null,
@@ -88,8 +87,6 @@
 	CALENDAR_HOME_METADATA(DEFAULT_EVENTS);
 create index CALENDAR_HOME_METADATA_DEFAULT_TASKS on
 	CALENDAR_HOME_METADATA(DEFAULT_TASKS);
-create index CALENDAR_HOME_METADATA_DEFAULT_POLLS on
-	CALENDAR_HOME_METADATA(DEFAULT_POLLS);
 
 -----------------------
 -- Calendar Metadata --
@@ -342,6 +339,9 @@
 create index ATTACHMENT_CALENDAR_HOME_RESOURCE_ID on
   ATTACHMENT(CALENDAR_HOME_RESOURCE_ID);
 
+create index ATTACHMENT_DROPBOX_ID on
+  ATTACHMENT(DROPBOX_ID);
+
 -- Many-to-many relationship between attachments and calendar objects
 create table ATTACHMENT_CALENDAR_OBJECT (
   ATTACHMENT_ID                  integer      not null references ATTACHMENT on delete cascade,

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v28.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v28.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v28.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -342,6 +342,9 @@
 create index ATTACHMENT_CALENDAR_HOME_RESOURCE_ID on
   ATTACHMENT(CALENDAR_HOME_RESOURCE_ID);
 
+create index ATTACHMENT_DROPBOX_ID on
+  ATTACHMENT(DROPBOX_ID);
+
 -- Many-to-many relationship between attachments and calendar objects
 create table ATTACHMENT_CALENDAR_OBJECT (
   ATTACHMENT_ID                  integer      not null references ATTACHMENT on delete cascade,
@@ -663,8 +666,7 @@
 create table PUSH_NOTIFICATION_WORK (
   WORK_ID                       integer      primary key default nextval('WORKITEM_SEQ') not null, -- implicit index
   NOT_BEFORE                    timestamp    default timezone('UTC', CURRENT_TIMESTAMP),
-  PUSH_ID                       varchar(255) not null,
-  PRIORITY                      integer      not null -- 1:low 5:medium 10:high
+  PUSH_ID                       varchar(255) not null
 );
 
 -----------------

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v29.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v29.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v29.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -109,16 +109,15 @@
 
 create table NOTIFICATION_HOME (
   RESOURCE_ID integer      primary key default nextval('RESOURCE_ID_SEQ'), -- implicit index
-  OWNER_UID   varchar(255) not null unique,                                -- implicit index
-  DATAVERSION integer      default 0 not null
+  OWNER_UID   varchar(255) not null unique                                 -- implicit index
 );
 
 create table NOTIFICATION (
   RESOURCE_ID                   integer      primary key default nextval('RESOURCE_ID_SEQ'), -- implicit index
   NOTIFICATION_HOME_RESOURCE_ID integer      not null references NOTIFICATION_HOME,
   NOTIFICATION_UID              varchar(255) not null,
-  NOTIFICATION_TYPE             varchar(255) not null,
-  NOTIFICATION_DATA             text         not null,
+  XML_TYPE                      varchar(255) not null,
+  XML_DATA                      text         not null,
   MD5                           char(32)     not null,
   CREATED                       timestamp    default timezone('UTC', CURRENT_TIMESTAMP),
   MODIFIED                      timestamp    default timezone('UTC', CURRENT_TIMESTAMP),
@@ -169,7 +168,6 @@
 insert into CALENDAR_BIND_MODE values (1, 'read' );
 insert into CALENDAR_BIND_MODE values (2, 'write');
 insert into CALENDAR_BIND_MODE values (3, 'direct');
-insert into CALENDAR_BIND_MODE values (4, 'indirect');
 
 -- Enumeration of statuses
 
@@ -182,7 +180,6 @@
 insert into CALENDAR_BIND_STATUS values (1, 'accepted');
 insert into CALENDAR_BIND_STATUS values (2, 'declined');
 insert into CALENDAR_BIND_STATUS values (3, 'invalid');
-insert into CALENDAR_BIND_STATUS values (4, 'deleted');
 
 
 -- Enumeration of transparency
@@ -345,6 +342,9 @@
 create index ATTACHMENT_CALENDAR_HOME_RESOURCE_ID on
   ATTACHMENT(CALENDAR_HOME_RESOURCE_ID);
 
+create index ATTACHMENT_DROPBOX_ID on
+  ATTACHMENT(DROPBOX_ID);
+
 -- Many-to-many relationship between attachments and calendar objects
 create table ATTACHMENT_CALENDAR_OBJECT (
   ATTACHMENT_ID                  integer      not null references ATTACHMENT on delete cascade,
@@ -705,4 +705,3 @@
 insert into CALENDARSERVER values ('VERSION', '29');
 insert into CALENDARSERVER values ('CALENDAR-DATAVERSION', '5');
 insert into CALENDARSERVER values ('ADDRESSBOOK-DATAVERSION', '2');
-insert into CALENDARSERVER values ('NOTIFICATION-DATAVERSION', '1');

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v30.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v30.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v30.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -345,6 +345,9 @@
 create index ATTACHMENT_CALENDAR_HOME_RESOURCE_ID on
   ATTACHMENT(CALENDAR_HOME_RESOURCE_ID);
 
+create index ATTACHMENT_DROPBOX_ID on
+  ATTACHMENT(DROPBOX_ID);
+
 -- Many-to-many relationship between attachments and calendar objects
 create table ATTACHMENT_CALENDAR_OBJECT (
   ATTACHMENT_ID                  integer      not null references ATTACHMENT on delete cascade,
@@ -454,24 +457,16 @@
 insert into ADDRESSBOOK_OBJECT_KIND values (3, 'location');
 
 
-----------------------------------
--- Revisions, forward reference --
-----------------------------------
-
-create sequence REVISION_SEQ;
-
 ---------------------------------
 -- Address Book Object Members --
 ---------------------------------
 
 create table ABO_MEMBERS (
-    GROUP_ID              integer      not null, -- references ADDRESSBOOK_OBJECT on delete cascade,	-- AddressBook Object's (kind=='group') RESOURCE_ID
+    GROUP_ID              integer      not null references ADDRESSBOOK_OBJECT on delete cascade,	-- AddressBook Object's (kind=='group') RESOURCE_ID
  	ADDRESSBOOK_ID		  integer      not null references ADDRESSBOOK_HOME on delete cascade,
-    MEMBER_ID             integer      not null, -- references ADDRESSBOOK_OBJECT,						-- member AddressBook Object's RESOURCE_ID
-  	REVISION              integer      default nextval('REVISION_SEQ') not null,
-  	REMOVED               boolean      default false not null,
+    MEMBER_ID             integer      not null references ADDRESSBOOK_OBJECT,						-- member AddressBook Object's RESOURCE_ID
 
-    primary key (GROUP_ID, MEMBER_ID, REVISION) -- implicit index
+    primary key (GROUP_ID, MEMBER_ID) -- implicit index
 );
 
 create index ABO_MEMBERS_ADDRESSBOOK_ID on
@@ -510,7 +505,7 @@
   MESSAGE                      		text,                  -- FIXME: xml?
 
   primary key (ADDRESSBOOK_HOME_RESOURCE_ID, GROUP_RESOURCE_ID), -- implicit index
-  unique (ADDRESSBOOK_HOME_RESOURCE_ID, GROUP_ADDRESSBOOK_NAME)  -- implicit index
+  unique (ADDRESSBOOK_HOME_RESOURCE_ID, GROUP_ADDRESSBOOK_NAME)     -- implicit index
 );
 
 create index SHARED_GROUP_BIND_RESOURCE_ID on
@@ -521,7 +516,7 @@
 -- Revisions --
 ---------------
 
--- create sequence REVISION_SEQ;
+create sequence REVISION_SEQ;
 
 
 -------------------------------
@@ -555,7 +550,6 @@
   ADDRESSBOOK_HOME_RESOURCE_ID 			integer			not null references ADDRESSBOOK_HOME,
   OWNER_HOME_RESOURCE_ID    			integer     	references ADDRESSBOOK_HOME,
   ADDRESSBOOK_NAME             			varchar(255) 	default null,
-  OBJECT_RESOURCE_ID					integer			default 0,
   RESOURCE_NAME                			varchar(255),
   REVISION                     			integer     	default nextval('REVISION_SEQ') not null,
   DELETED                      			boolean      	not null

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v31.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v31.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/old/postgres-dialect/v31.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -53,22 +53,10 @@
 
 create table CALENDAR_HOME (
   RESOURCE_ID      integer      primary key default nextval('RESOURCE_ID_SEQ'), -- implicit index
-  OWNER_UID        varchar(255) not null unique,                                -- implicit index
-  STATUS           integer      default 0 not null,                             -- enum HOME_STATUS
+  OWNER_UID        varchar(255) not null unique,                                 -- implicit index
   DATAVERSION      integer      default 0 not null
 );
 
--- Enumeration of statuses
-
-create table HOME_STATUS (
-  ID          integer     primary key,
-  DESCRIPTION varchar(16) not null unique
-);
-
-insert into HOME_STATUS values (0, 'normal' );
-insert into HOME_STATUS values (1, 'external');
-
-
 --------------
 -- Calendar --
 --------------
@@ -77,7 +65,6 @@
   RESOURCE_ID integer   primary key default nextval('RESOURCE_ID_SEQ') -- implicit index
 );
 
-
 ----------------------------
 -- Calendar Home Metadata --
 ----------------------------
@@ -104,7 +91,6 @@
 create index CALENDAR_HOME_METADATA_DEFAULT_POLLS on
 	CALENDAR_HOME_METADATA(DEFAULT_POLLS);
 
-
 -----------------------
 -- Calendar Metadata --
 -----------------------
@@ -124,7 +110,6 @@
 create table NOTIFICATION_HOME (
   RESOURCE_ID integer      primary key default nextval('RESOURCE_ID_SEQ'), -- implicit index
   OWNER_UID   varchar(255) not null unique,                                -- implicit index
-  STATUS      integer      default 0 not null,                             -- enum HOME_STATUS
   DATAVERSION integer      default 0 not null
 );
 
@@ -154,7 +139,6 @@
 create table CALENDAR_BIND (
   CALENDAR_HOME_RESOURCE_ID integer      not null references CALENDAR_HOME,
   CALENDAR_RESOURCE_ID      integer      not null references CALENDAR on delete cascade,
-  EXTERNAL_ID			    integer      default null,
   CALENDAR_RESOURCE_NAME    varchar(255) not null,
   BIND_MODE                 integer      not null, -- enum CALENDAR_BIND_MODE
   BIND_STATUS               integer      not null, -- enum CALENDAR_BIND_STATUS
@@ -361,6 +345,9 @@
 create index ATTACHMENT_CALENDAR_HOME_RESOURCE_ID on
   ATTACHMENT(CALENDAR_HOME_RESOURCE_ID);
 
+create index ATTACHMENT_DROPBOX_ID on
+  ATTACHMENT(DROPBOX_ID);
+
 -- Many-to-many relationship between attachments and calendar objects
 create table ATTACHMENT_CALENDAR_OBJECT (
   ATTACHMENT_ID                  integer      not null references ATTACHMENT on delete cascade,
@@ -396,7 +383,6 @@
   RESOURCE_ID      				integer			primary key default nextval('RESOURCE_ID_SEQ'), -- implicit index
   ADDRESSBOOK_PROPERTY_STORE_ID	integer      	default nextval('RESOURCE_ID_SEQ') not null, 	-- implicit index
   OWNER_UID        				varchar(255) 	not null unique,                                -- implicit index
-  STATUS           				integer      	default 0 not null,                             -- enum HOME_STATUS
   DATAVERSION      				integer      	default 0 not null
 );
 
@@ -422,7 +408,6 @@
 create table SHARED_ADDRESSBOOK_BIND (
   ADDRESSBOOK_HOME_RESOURCE_ID			integer			not null references ADDRESSBOOK_HOME,
   OWNER_HOME_RESOURCE_ID    			integer      	not null references ADDRESSBOOK_HOME on delete cascade,
-  EXTERNAL_ID			                integer         default null,
   ADDRESSBOOK_RESOURCE_NAME    			varchar(255) 	not null,
   BIND_MODE                    			integer      	not null,	-- enum CALENDAR_BIND_MODE
   BIND_STATUS                  			integer      	not null,	-- enum CALENDAR_BIND_STATUS
@@ -521,7 +506,6 @@
 create table SHARED_GROUP_BIND (	
   ADDRESSBOOK_HOME_RESOURCE_ID 		integer      not null references ADDRESSBOOK_HOME,
   GROUP_RESOURCE_ID      			integer      not null references ADDRESSBOOK_OBJECT on delete cascade,
-  EXTERNAL_ID			            integer      default null,
   GROUP_ADDRESSBOOK_NAME			varchar(255) not null,
   BIND_MODE                    		integer      not null, -- enum CALENDAR_BIND_MODE
   BIND_STATUS                  		integer      not null, -- enum CALENDAR_BIND_STATUS

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_26_to_27.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_26_to_27.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_26_to_27.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -18,13 +18,10 @@
 -- Upgrade database schema from VERSION 26 to 27 --
 ---------------------------------------------------
 
--- Calendar home related updates
+-- New index
 
-alter table CALENDAR_HOME_METADATA
- add ("DEFAULT_POLLS" integer default null references CALENDAR on delete set null);
-
-create index CALENDAR_HOME_METADAT_910264ce on CALENDAR_HOME_METADATA (
-    DEFAULT_POLLS
+create index ATTACHMENT_DROPBOX_ID_5073cf23 on ATTACHMENT (
+    DROPBOX_ID
 );
 
 

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_27_to_28.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_27_to_28.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_27_to_28.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -18,12 +18,16 @@
 -- Upgrade database schema from VERSION 27 to 28 --
 ---------------------------------------------------
 
--- Push notification work related updates
+-- Calendar home related updates
 
-alter table PUSH_NOTIFICATION_WORK
- add ("PRIORITY" integer default 10 not null);
+alter table CALENDAR_HOME_METADATA
+ add ("DEFAULT_POLLS" integer default null references CALENDAR on delete set null);
 
-update PUSH_NOTIFICATION_WORK set PRIORITY = 10;
+create index CALENDAR_HOME_METADAT_910264ce on CALENDAR_HOME_METADATA (
+    DEFAULT_POLLS
+);
 
+
 -- Now update the version
+-- No data upgrades
 update CALENDARSERVER set VALUE = '28' where NAME = 'VERSION';

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_28_to_29.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_28_to_29.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_28_to_29.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -18,21 +18,12 @@
 -- Upgrade database schema from VERSION 28 to 29 --
 ---------------------------------------------------
 
--- Sharing notification related updates
+-- Push notification work related updates
 
-alter table NOTIFICATION_HOME
- add ("DATAVERSION" integer default 0 not null);
+alter table PUSH_NOTIFICATION_WORK
+ add ("PRIORITY" integer default 10 not null);
 
-alter table NOTIFICATION
-  rename column XML_TYPE to NOTIFICATION_TYPE;
-alter table NOTIFICATION
-  rename column XML_DATA to NOTIFICATION_DATA;
+update PUSH_NOTIFICATION_WORK set PRIORITY = 10;
 
-  -- Sharing enumeration updates
-insert into CALENDAR_BIND_MODE (DESCRIPTION, ID) values ('indirect', 4);
-
-insert into CALENDAR_BIND_STATUS (DESCRIPTION, ID) values ('deleted', 4);
-
 -- Now update the version
 update CALENDARSERVER set VALUE = '29' where NAME = 'VERSION';
-insert into CALENDARSERVER (NAME, VALUE) values ('NOTIFICATION-DATAVERSION', '1');

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_29_to_30.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_29_to_30.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_29_to_30.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -18,35 +18,21 @@
 -- Upgrade database schema from VERSION 29 to 30 --
 ---------------------------------------------------
 
-----------------------------------------
--- Change Address Book Object Members --
-----------------------------------------
+-- Sharing notification related updates
 
-begin
-for i in (select constraint_name from user_cons_columns where column_name = 'MEMBER_ID' or column_name = 'GROUP_ID')
-loop
-execute immediate 'alter table abo_members drop constraint' || i.constraint_name;
-end loop;
-end;
+alter table NOTIFICATION_HOME
+ add ("DATAVERSION" integer default 0 not null);
 
-alter table ABO_MEMBERS
-	add ("REVISION" integer default nextval('REVISION_SEQ') not null);
-alter table ABO_MEMBERS
-	add ("REMOVED" boolean default false not null);
-alter table ABO_MEMBERS
-	 drop primary key;
-alter table ABO_MEMBERS
-	 add primary key ("GROUP_ID", "MEMBER_ID", "REVISION");
+alter table NOTIFICATION
+  rename column XML_TYPE to NOTIFICATION_TYPE;
+alter table NOTIFICATION
+  rename column XML_DATA to NOTIFICATION_DATA;
 
-------------------------------------------
--- Change Address Book Object Revisions --
-------------------------------------------
-	
-alter table ADDRESSBOOK_OBJECT_REVISIONS
-	add ("OBJECT_RESOURCE_ID" integer default 0);
+  -- Sharing enumeration updates
+insert into CALENDAR_BIND_MODE (DESCRIPTION, ID) values ('indirect', 4);
 
---------------------
--- Update version --
---------------------
+insert into CALENDAR_BIND_STATUS (DESCRIPTION, ID) values ('deleted', 4);
 
+-- Now update the version
 update CALENDARSERVER set VALUE = '30' where NAME = 'VERSION';
+insert into CALENDARSERVER (NAME, VALUE) values ('NOTIFICATION-DATAVERSION', '1');

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_30_to_31.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_30_to_31.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_30_to_31.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -18,36 +18,35 @@
 -- Upgrade database schema from VERSION 30 to 31 --
 ---------------------------------------------------
 
--- Home related updates
+----------------------------------------
+-- Change Address Book Object Members --
+----------------------------------------
 
-alter table CALENDAR_HOME
- add ("STATUS" integer default 0 not null);
+begin
+for i in (select constraint_name from user_cons_columns where column_name = 'MEMBER_ID' or column_name = 'GROUP_ID')
+loop
+execute immediate 'alter table abo_members drop constraint' || i.constraint_name;
+end loop;
+end;
 
-alter table NOTIFICATION_HOME
- add ("STATUS" integer default 0 not null);
+alter table ABO_MEMBERS
+	add ("REVISION" integer default nextval('REVISION_SEQ') not null);
+alter table ABO_MEMBERS
+	add ("REMOVED" boolean default false not null);
+alter table ABO_MEMBERS
+	 drop primary key;
+alter table ABO_MEMBERS
+	 add primary key ("GROUP_ID", "MEMBER_ID", "REVISION");
 
-alter table ADDRESSBOOK_HOME
- add ("STATUS" integer default 0 not null);
+------------------------------------------
+-- Change Address Book Object Revisions --
+------------------------------------------
+	
+alter table ADDRESSBOOK_OBJECT_REVISIONS
+	add ("OBJECT_RESOURCE_ID" integer default 0);
 
-create table HOME_STATUS (
-    "ID" integer primary key,
-    "DESCRIPTION" nvarchar2(16) unique
-);
+--------------------
+-- Update version --
+--------------------
 
-insert into HOME_STATUS (DESCRIPTION, ID) values ('normal', 0);
-insert into HOME_STATUS (DESCRIPTION, ID) values ('external', 1);
-
--- Bind changes
-alter table CALENDAR_BIND
- add ("EXTERNAL_ID" integer default null);
-
-alter table SHARED_ADDRESSBOOK_BIND
- add ("EXTERNAL_ID" integer default null);
-
-alter table SHARED_GROUP_BIND
- add ("EXTERNAL_ID" integer default null);
-
-
--- Now update the version
--- No data upgrades
 update CALENDARSERVER set VALUE = '31' where NAME = 'VERSION';

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_31_to_32.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_31_to_32.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_31_to_32.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -18,13 +18,36 @@
 -- Upgrade database schema from VERSION 31 to 32 --
 ---------------------------------------------------
 
--- New index
+-- Home related updates
 
-create index ATTACHMENT_DROPBOX_ID_5073cf23 on ATTACHMENT (
-    DROPBOX_ID
+alter table CALENDAR_HOME
+ add ("STATUS" integer default 0 not null);
+
+alter table NOTIFICATION_HOME
+ add ("STATUS" integer default 0 not null);
+
+alter table ADDRESSBOOK_HOME
+ add ("STATUS" integer default 0 not null);
+
+create table HOME_STATUS (
+    "ID" integer primary key,
+    "DESCRIPTION" nvarchar2(16) unique
 );
 
+insert into HOME_STATUS (DESCRIPTION, ID) values ('normal', 0);
+insert into HOME_STATUS (DESCRIPTION, ID) values ('external', 1);
 
+-- Bind changes
+alter table CALENDAR_BIND
+ add ("EXTERNAL_ID" integer default null);
+
+alter table SHARED_ADDRESSBOOK_BIND
+ add ("EXTERNAL_ID" integer default null);
+
+alter table SHARED_GROUP_BIND
+ add ("EXTERNAL_ID" integer default null);
+
+
 -- Now update the version
 -- No data upgrades
 update CALENDARSERVER set VALUE = '32' where NAME = 'VERSION';

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_26_to_27.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_26_to_27.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_26_to_27.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -18,13 +18,11 @@
 -- Upgrade database schema from VERSION 26 to 27 --
 ---------------------------------------------------
 
--- Calendar home related updates
+-- New index
 
-alter table CALENDAR_HOME_METADATA
- add column DEFAULT_POLLS integer default null references CALENDAR on delete set null;
+create index ATTACHMENT_DROPBOX_ID on
+  ATTACHMENT(DROPBOX_ID);
 
-create index CALENDAR_HOME_METADATA_DEFAULT_POLLS on
-	CALENDAR_HOME_METADATA(DEFAULT_POLLS);
 
 -- Now update the version
 -- No data upgrades

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_27_to_28.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_27_to_28.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_27_to_28.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -18,12 +18,14 @@
 -- Upgrade database schema from VERSION 27 to 28 --
 ---------------------------------------------------
 
--- Push notification work related updates
+-- Calendar home related updates
 
-alter table PUSH_NOTIFICATION_WORK
- add column PRIORITY integer default 10 not null;
+alter table CALENDAR_HOME_METADATA
+ add column DEFAULT_POLLS integer default null references CALENDAR on delete set null;
 
-update PUSH_NOTIFICATION_WORK set PRIORITY = 10;
+create index CALENDAR_HOME_METADATA_DEFAULT_POLLS on
+	CALENDAR_HOME_METADATA(DEFAULT_POLLS);
 
 -- Now update the version
+-- No data upgrades
 update CALENDARSERVER set VALUE = '28' where NAME = 'VERSION';

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_28_to_29.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_28_to_29.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_28_to_29.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -18,21 +18,12 @@
 -- Upgrade database schema from VERSION 28 to 29 --
 ---------------------------------------------------
 
--- Sharing notification related updates
+-- Push notification work related updates
 
-alter table NOTIFICATION_HOME
-  add column DATAVERSION integer default 0 not null;
+alter table PUSH_NOTIFICATION_WORK
+ add column PRIORITY integer default 10 not null;
 
-alter table NOTIFICATION
-  rename column XML_TYPE to NOTIFICATION_TYPE;
-alter table NOTIFICATION
-  rename column XML_DATA to NOTIFICATION_DATA;
+update PUSH_NOTIFICATION_WORK set PRIORITY = 10;
 
--- Sharing enumeration updates
-insert into CALENDAR_BIND_MODE values (4, 'indirect');
-
-insert into CALENDAR_BIND_STATUS values (4, 'deleted');
-
 -- Now update the version
 update CALENDARSERVER set VALUE = '29' where NAME = 'VERSION';
-insert into CALENDARSERVER values ('NOTIFICATION-DATAVERSION', '1');

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_29_to_30.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_29_to_30.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_29_to_30.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -18,27 +18,21 @@
 -- Upgrade database schema from VERSION 29 to 30 --
 ---------------------------------------------------
 
-----------------------------------------
--- Change Address Book Object Members --
-----------------------------------------
+-- Sharing notification related updates
 
-alter table ABO_MEMBERS
-	drop constraint	abo_members_member_id_fkey,
-	drop constraint	abo_members_group_id_fkey,
-	add column	REVISION		integer      default nextval('REVISION_SEQ') not null,
-	add column	REMOVED         boolean      default false not null,
-	drop constraint abo_members_pkey,
-	add constraint abo_members_pkey primary key(GROUP_ID, MEMBER_ID, REVISION);
+alter table NOTIFICATION_HOME
+  add column DATAVERSION integer default 0 not null;
 
-------------------------------------------
--- Change Address Book Object Revisions --
-------------------------------------------
-	
-alter table ADDRESSBOOK_OBJECT_REVISIONS
-	add column OBJECT_RESOURCE_ID integer default 0;
-	
---------------------
--- Update version --
---------------------
+alter table NOTIFICATION
+  rename column XML_TYPE to NOTIFICATION_TYPE;
+alter table NOTIFICATION
+  rename column XML_DATA to NOTIFICATION_DATA;
 
+-- Sharing enumeration updates
+insert into CALENDAR_BIND_MODE values (4, 'indirect');
+
+insert into CALENDAR_BIND_STATUS values (4, 'deleted');
+
+-- Now update the version
 update CALENDARSERVER set VALUE = '30' where NAME = 'VERSION';
+insert into CALENDARSERVER values ('NOTIFICATION-DATAVERSION', '1');

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_30_to_31.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_30_to_31.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_30_to_31.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -18,38 +18,27 @@
 -- Upgrade database schema from VERSION 30 to 31 --
 ---------------------------------------------------
 
--- Home related updates
+----------------------------------------
+-- Change Address Book Object Members --
+----------------------------------------
 
-alter table CALENDAR_HOME
- add column STATUS integer default 0 not null;
+alter table ABO_MEMBERS
+	drop constraint	abo_members_member_id_fkey,
+	drop constraint	abo_members_group_id_fkey,
+	add column	REVISION		integer      default nextval('REVISION_SEQ') not null,
+	add column	REMOVED         boolean      default false not null,
+	drop constraint abo_members_pkey,
+	add constraint abo_members_pkey primary key(GROUP_ID, MEMBER_ID, REVISION);
 
-alter table NOTIFICATION_HOME
- add column STATUS integer default 0 not null;
+------------------------------------------
+-- Change Address Book Object Revisions --
+------------------------------------------
+	
+alter table ADDRESSBOOK_OBJECT_REVISIONS
+	add column OBJECT_RESOURCE_ID integer default 0;
+	
+--------------------
+-- Update version --
+--------------------
 
-alter table ADDRESSBOOK_HOME
- add column STATUS integer default 0 not null;
-
--- Enumeration of statuses
-
-create table HOME_STATUS (
-  ID          integer     primary key,
-  DESCRIPTION varchar(16) not null unique
-);
-
-insert into HOME_STATUS values (0, 'normal' );
-insert into HOME_STATUS values (1, 'external');
-
--- Bind changes
-alter table CALENDAR_BIND
- add column EXTERNAL_ID integer default null;
-
-alter table SHARED_ADDRESSBOOK_BIND
- add column EXTERNAL_ID integer default null;
-
-alter table SHARED_GROUP_BIND
- add column EXTERNAL_ID integer default null;
-
-
--- Now update the version
--- No data upgrades
 update CALENDARSERVER set VALUE = '31' where NAME = 'VERSION';

Modified: CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_31_to_32.sql
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_31_to_32.sql	2014-01-03 19:57:55 UTC (rev 12231)
+++ CalendarServer/trunk/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_31_to_32.sql	2014-01-03 20:06:54 UTC (rev 12232)
@@ -18,12 +18,38 @@
 -- Upgrade database schema from VERSION 31 to 32 --
 ---------------------------------------------------
 
--- New index
+-- Home related updates
 
-create index ATTACHMENT_DROPBOX_ID on
-  ATTACHMENT(DROPBOX_ID);
+alter table CALENDAR_HOME
+ add column STATUS integer default 0 not null;
 
+alter table NOTIFICATION_HOME
+ add column STATUS integer default 0 not null;
 
+alter table ADDRESSBOOK_HOME
+ add column STATUS integer default 0 not null;
+
+-- Enumeration of statuses
+
+create table HOME_STATUS (
+  ID          integer     primary key,
+  DESCRIPTION varchar(16) not null unique
+);
+
+insert into HOME_STATUS values (0, 'normal' );
+insert into HOME_STATUS values (1, 'external');
+
+-- Bind changes
+alter table CALENDAR_BIND
+ add column EXTERNAL_ID integer default null;
+
+alter table SHARED_ADDRESSBOOK_BIND
+ add column EXTERNAL_ID integer default null;
+
+alter table SHARED_GROUP_BIND
+ add column EXTERNAL_ID integer default null;
+
+
 -- Now update the version
 -- No data upgrades
 update CALENDARSERVER set VALUE = '32' where NAME = 'VERSION';
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/081da11d/attachment.html>


More information about the calendarserver-changes mailing list