<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[13755] CalendarServer/branches/users/gaya/groupsharee2/txdav</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/13755">13755</a></dd>
<dt>Author</dt> <dd>gaya@apple.com</dd>
<dt>Date</dt> <dd>2014-07-11 18:30:42 -0700 (Fri, 11 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>remove CALENDAR_HOME_ID column from GROUP_SHAREE table</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesusersgayagroupsharee2txdavcaldavdatastoresqlpy">CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/datastore/sql.py</a></li>
<li><a href="#CalendarServerbranchesusersgayagroupsharee2txdavcommondatastoresql_schemacurrentoracledialectsql">CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/current-oracle-dialect.sql</a></li>
<li><a href="#CalendarServerbranchesusersgayagroupsharee2txdavcommondatastoresql_schemacurrentsql">CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/current.sql</a></li>
<li><a href="#CalendarServerbranchesusersgayagroupsharee2txdavcommondatastoresql_schemaupgradesoracledialectupgrade_from_45_to_46sql">CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_45_to_46.sql</a></li>
<li><a href="#CalendarServerbranchesusersgayagroupsharee2txdavcommondatastoresql_schemaupgradespostgresdialectupgrade_from_45_to_46sql">CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_45_to_46.sql</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesusersgayagroupsharee2txdavcaldavdatastoresqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/datastore/sql.py (13754 => 13755)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/datastore/sql.py        2014-07-11 23:57:30 UTC (rev 13754)
+++ CalendarServer/branches/users/gaya/groupsharee2/txdav/caldav/datastore/sql.py        2014-07-12 01:30:42 UTC (rev 13755)
</span><span class="lines">@@ -1807,11 +1807,11 @@
</span><span class="cx">             _BIND_MODE_GROUP_READ: _BIND_MODE_GROUP_READ,
</span><span class="cx">             _BIND_MODE_WRITE: _BIND_MODE_GROUP_WRITE,
</span><span class="cx">             _BIND_MODE_GROUP_WRITE: _BIND_MODE_GROUP_WRITE,
</span><del>-        }.get(self.shareMode())
</del><ins>+        }.get(self._bindMode)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><del>-    def groupModeAfterRemovingOneGroupSharee(self):
</del><ins>+    def _groupModeAfterRemovingOneGroupSharee(self):
</ins><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         return group mode after removing one group sharee or None
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="lines">@@ -1820,17 +1820,16 @@
</span><span class="cx">         rows = yield Select(
</span><span class="cx">             [Count(gs.GROUP_ID)],
</span><span class="cx">             From=gs,
</span><del>-            Where=(gs.CALENDAR_HOME_ID == self.viewerHome()._resourceID).And(
-                gs.CALENDAR_ID == self._resourceID)
</del><ins>+            Where=gs.CALENDAR_ID == self._resourceID
</ins><span class="cx">         ).on(self._txn)
</span><del>-        if rows[0][0] &gt; 1:
</del><ins>+        if rows[0][0] &gt; 0:
</ins><span class="cx">             # no mode change for group shares
</span><span class="cx">             returnValue(
</span><span class="cx">                 {
</span><span class="cx">                     _BIND_MODE_GROUP: _BIND_MODE_GROUP,
</span><span class="cx">                     _BIND_MODE_GROUP_READ: _BIND_MODE_GROUP_READ,
</span><span class="cx">                     _BIND_MODE_GROUP_WRITE: _BIND_MODE_GROUP_WRITE,
</span><del>-                }.get(self.shareMode())
</del><ins>+                }.get(self._bindMode)
</ins><span class="cx">             )
</span><span class="cx"> 
</span><span class="cx">         # else return mode without any groups
</span><span class="lines">@@ -1838,7 +1837,7 @@
</span><span class="cx">             {
</span><span class="cx">                 _BIND_MODE_GROUP_READ: _BIND_MODE_READ,
</span><span class="cx">                 _BIND_MODE_GROUP_WRITE: _BIND_MODE_WRITE,
</span><del>-            }.get(self.shareMode())
</del><ins>+            }.get(self._bindMode)
</ins><span class="cx">         )
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -1857,8 +1856,7 @@
</span><span class="cx">         rows = yield Select(
</span><span class="cx">             [gs.MEMBERSHIP_HASH, gs.GROUP_BIND_MODE],
</span><span class="cx">             From=gs,
</span><del>-            Where=(gs.CALENDAR_HOME_ID == self.viewerHome()._resourceID).And(
-                gs.CALENDAR_ID == self._resourceID).And(
</del><ins>+            Where=(gs.CALENDAR_ID == self._resourceID).And(
</ins><span class="cx">                 gs.GROUP_ID == groupID)
</span><span class="cx">         ).on(self._txn)
</span><span class="cx">         if rows:
</span><span class="lines">@@ -1871,8 +1869,7 @@
</span><span class="cx">             if updateMap:
</span><span class="cx">                 yield Update(
</span><span class="cx">                     updateMap,
</span><del>-                    Where=(gs.CALENDAR_HOME_ID == self.viewerHome()._resourceID).And(
-                        gs.CALENDAR_ID == self._resourceID).And(
</del><ins>+                    Where=(gs.CALENDAR_ID == self._resourceID).And(
</ins><span class="cx">                         gs.GROUP_ID == groupID
</span><span class="cx">                     )
</span><span class="cx">                 ).on(self._txn)
</span><span class="lines">@@ -1881,7 +1878,6 @@
</span><span class="cx">             yield Insert({
</span><span class="cx">                 gs.MEMBERSHIP_HASH: membershipHash,
</span><span class="cx">                 gs.GROUP_BIND_MODE: mode,
</span><del>-                gs.CALENDAR_HOME_ID: self.viewerHome()._resourceID,
</del><span class="cx">                 gs.CALENDAR_ID: self._resourceID,
</span><span class="cx">                 gs.GROUP_ID: groupID,
</span><span class="cx">             }).on(self._txn)
</span><span class="lines">@@ -1896,15 +1892,23 @@
</span><span class="cx">             returnValue(_BIND_MODE_WRITE)
</span><span class="cx">         elif self._bindMode in (_BIND_MODE_GROUP, _BIND_MODE_GROUP_READ):
</span><span class="cx">             gs = schema.GROUP_SHAREE
</span><ins>+            gm = schema.GROUP_MEMBERSHIP
</ins><span class="cx">             rows = yield Select(
</span><span class="cx">                 [Max(gs.GROUP_BIND_MODE)], # _BIND_MODE_WRITE &gt; _BIND_MODE_READ
</span><span class="cx">                 From=gs,
</span><del>-                Where=(gs.CALENDAR_HOME_ID == self.viewerHome()._resourceID).And(
-                    gs.CALENDAR_ID == self._resourceID
</del><ins>+                 Where=(
+                    gs.GROUP_ID.In(
+                        Select(
+                            [gm.GROUP_ID],
+                            From=gm,
+                            Where=(
+                                gm.MEMBER_UID == Parameter(&quot;uid&quot;)
+                            )
+                        )
+                    )
</ins><span class="cx">                 )
</span><del>-            ).on(self._txn)
-            groupShareMode = rows[0][0]
-            returnValue(groupShareMode)
</del><ins>+            ).on(self._txn, uid=self.viewerHome().uid())
+            returnValue(rows[0][0])
</ins><span class="cx">         else:
</span><span class="cx">             returnValue(self._bindMode)
</span><span class="cx"> 
</span><span class="lines">@@ -1939,6 +1943,8 @@
</span><span class="cx">                 (yield super(Calendar, self).inviteUIDToShare(shareeUID, mode, summary, shareName))
</span><span class="cx">             )
</span><span class="cx"> 
</span><ins>+        yield self.updateShareeGroupLink(shareeUID, mode=mode)
+
</ins><span class="cx">         # invite every member of group
</span><span class="cx">         shareeViews = set()
</span><span class="cx">         groupID = (yield self._txn.groupByUID(shareeUID))[0]
</span><span class="lines">@@ -1949,7 +1955,6 @@
</span><span class="cx">             if newMode is not None:
</span><span class="cx">                 # everything but direct share
</span><span class="cx">                 shareeView = yield super(Calendar, self).inviteUIDToShare(memberUID, newMode, summary)
</span><del>-                yield shareeView.updateShareeGroupLink(shareeUID, mode=mode)
</del><span class="cx">                 shareeViews.add(shareeView)
</span><span class="cx"> 
</span><span class="cx">         returnValue(shareeViews)
</span><span class="lines">@@ -1984,67 +1989,49 @@
</span><span class="cx">     @inlineCallbacks
</span><span class="cx">     def uninviteUIDFromShare(self, shareeUID):
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        Remove a user from a share. Make sure a notification is sent as well.
</del><ins>+        Remove a user or group from a share. Make sure a notification is sent as well.
</ins><span class="cx"> 
</span><span class="cx">         @param shareeUID: UID of the sharee
</span><span class="cx">         @type shareeUID: C{str}
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx"> 
</span><del>-        if not (
-            config.Sharing.Enabled and
-            config.Sharing.Calendars.Enabled and
-            config.Sharing.Calendars.Groups.Enabled
-        ):
-            returnValue(
-                (yield super(Calendar, self).uninviteUIDFromShare(shareeUID))
-            )
</del><ins>+        # see if cached group
+        groupID = (yield self._txn.groupByUID(shareeUID, create=False))[0]
+        if groupID:
</ins><span class="cx"> 
</span><del>-        record = yield self._txn.directoryService().recordWithUID(shareeUID.decode(&quot;utf-8&quot;))
-        if (
-            record is None or
-            record.recordType != RecordType.group
-        ):
-            # delete all group sharees and individual sharees
-            shareeView = yield self.shareeView(shareeUID)
-            if shareeView is None:
-                returnValue(None)
-
-            # delete all group links for view's home
</del><ins>+            # see if group sharee for self &amp; delete
</ins><span class="cx">             gs = schema.GROUP_SHAREE
</span><del>-            yield Delete(
</del><ins>+            rows = yield Delete(
</ins><span class="cx">                 From=gs,
</span><del>-                Where=(gs.CALENDAR_HOME_ID == shareeView.viewerHome()._resourceID).And(
-                    gs.CALENDAR_ID == self._resourceID)
-            )
</del><ins>+                Where=(gs.CALENDAR_ID == self._resourceID).And(
+                    gs.GROUP_ID == groupID
+                ),
+                Return=[gs.GROUP_ID]
+            ).on(self._txn)
</ins><span class="cx"> 
</span><del>-            returnValue(
-                (yield super(Calendar, self).uninviteUIDFromShare(shareeUID))
-            )
</del><ins>+            if rows:
+                # uninvite each member of group
+                memberUIDs = yield self._txn.groupMemberUIDs(groupID)
+                for memberUID in memberUIDs:
+                    shareeView = yield self.shareeView(memberUID)
+                    if shareeView is not None:
</ins><span class="cx"> 
</span><del>-        # uninvite every member of group
-        groupID = (yield self._txn.groupByUID(shareeUID))[0]
-        memberUIDs = yield self._txn.groupMemberUIDs(groupID)
-        for memberUID in memberUIDs:
-            shareeView = yield self.shareeView(memberUID)
-            if shareeView is not None:
</del><ins>+                        newMode = yield shareeView._groupModeAfterRemovingOneGroupSharee()
+                        if newMode is None:
+                            # only group was shared, do delete share
+                            yield super(Calendar, self).uninviteUIDFromShare(memberUID)
+                        else:
+                            # multiple groups or group and individual was shared, update to new mode
+                            yield super(Calendar, self).inviteUIDToShare(memberUID, newMode)
</ins><span class="cx"> 
</span><del>-                newMode = yield shareeView.groupModeAfterRemovingOneGroupSharee()
-                gs = schema.GROUP_SHAREE
-                yield Delete(
-                    From=gs,
-                    Where=(gs.CALENDAR_HOME_ID == shareeView.viewerHome()._resourceID).And(
-                        gs.CALENDAR_ID == self._resourceID).And(
-                        gs.GROUP_ID == groupID
-                    )
-                )
-                if newMode is None:
-                    # only group was shared, do delete share
-                    yield super(Calendar, self).uninviteUIDFromShare(memberUID)
-                else:
-                    # multiple groups or group and individual was shared, update to new mode
-                    yield super(Calendar, self).inviteUIDToShare(memberUID, newMode)
</del><ins>+                returnValue(None)
</ins><span class="cx"> 
</span><ins>+        returnValue(
+            (yield super(Calendar, self).uninviteUIDFromShare(shareeUID))
+        )
</ins><span class="cx"> 
</span><ins>+
+
</ins><span class="cx"> icalfbtype_to_indexfbtype = {
</span><span class="cx">     &quot;UNKNOWN&quot;         : 0,
</span><span class="cx">     &quot;FREE&quot;            : 1,
</span><span class="lines">@@ -2379,10 +2366,9 @@
</span><span class="cx">                 else:
</span><span class="cx">                     # delete existing group rows
</span><span class="cx">                     ga = schema.GROUP_ATTENDEE
</span><del>-                    rows = yield Delete(
</del><ins>+                    yield Delete(
</ins><span class="cx">                         From=ga,
</span><span class="cx">                         Where=ga.RESOURCE_ID == self._resourceID,
</span><del>-                        #Return=[ga.GROUP_ID]
</del><span class="cx">                     ).on(txn)
</span><span class="cx"> 
</span><span class="cx">         returnValue(isOldEventWithGroupAttendees)
</span></span></pre></div>
<a id="CalendarServerbranchesusersgayagroupsharee2txdavcommondatastoresql_schemacurrentoracledialectsql"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/current-oracle-dialect.sql (13754 => 13755)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/current-oracle-dialect.sql        2014-07-11 23:57:30 UTC (rev 13754)
+++ CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/current-oracle-dialect.sql        2014-07-12 01:30:42 UTC (rev 13755)
</span><span class="lines">@@ -444,11 +444,10 @@
</span><span class="cx"> 
</span><span class="cx"> create table GROUP_SHAREE (
</span><span class="cx">     &quot;GROUP_ID&quot; integer not null references GROUPS on delete cascade,
</span><del>-    &quot;CALENDAR_HOME_ID&quot; integer not null references CALENDAR_HOME on delete cascade,
</del><span class="cx">     &quot;CALENDAR_ID&quot; integer not null references CALENDAR on delete cascade,
</span><span class="cx">     &quot;GROUP_BIND_MODE&quot; integer not null,
</span><span class="cx">     &quot;MEMBERSHIP_HASH&quot; nvarchar2(255), 
</span><del>-    primary key (&quot;GROUP_ID&quot;, &quot;CALENDAR_HOME_ID&quot;, &quot;CALENDAR_ID&quot;)
</del><ins>+    primary key (&quot;GROUP_ID&quot;, &quot;CALENDAR_ID&quot;)
</ins><span class="cx"> );
</span><span class="cx"> 
</span><span class="cx"> create table DELEGATES (
</span><span class="lines">@@ -791,10 +790,6 @@
</span><span class="cx">     GROUP_ID
</span><span class="cx"> );
</span><span class="cx"> 
</span><del>-create index GROUP_SHAREE_CALENDAR_a9feee17 on GROUP_SHAREE (
-    CALENDAR_HOME_ID
-);
-
</del><span class="cx"> create index GROUP_SHAREE_CALENDAR_28a88850 on GROUP_SHAREE (
</span><span class="cx">     CALENDAR_ID
</span><span class="cx"> );
</span></span></pre></div>
<a id="CalendarServerbranchesusersgayagroupsharee2txdavcommondatastoresql_schemacurrentsql"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/current.sql (13754 => 13755)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/current.sql        2014-07-11 23:57:30 UTC (rev 13754)
+++ CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/current.sql        2014-07-12 01:30:42 UTC (rev 13755)
</span><span class="lines">@@ -828,16 +828,13 @@
</span><span class="cx"> 
</span><span class="cx"> create table GROUP_SHAREE (
</span><span class="cx">   GROUP_ID                      integer not null references GROUPS on delete cascade,
</span><del>-  CALENDAR_HOME_ID                                 integer not null references CALENDAR_HOME on delete cascade,
</del><span class="cx">   CALENDAR_ID                                      integer not null references CALENDAR on delete cascade,
</span><span class="cx">   GROUP_BIND_MODE               integer not null, -- enum CALENDAR_BIND_MODE
</span><span class="cx">   MEMBERSHIP_HASH               varchar(255) not null,
</span><span class="cx">   
</span><del>-  primary key (GROUP_ID, CALENDAR_HOME_ID, CALENDAR_ID)
</del><ins>+  primary key (GROUP_ID, CALENDAR_ID)
</ins><span class="cx"> );
</span><span class="cx"> 
</span><del>-create index GROUP_SHAREE_CALENDAR_HOME_ID on
-  GROUP_SHAREE(CALENDAR_HOME_ID);
</del><span class="cx"> create index GROUP_SHAREE_CALENDAR_ID on
</span><span class="cx">   GROUP_SHAREE(CALENDAR_ID);
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServerbranchesusersgayagroupsharee2txdavcommondatastoresql_schemaupgradesoracledialectupgrade_from_45_to_46sql"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_45_to_46.sql (13754 => 13755)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_45_to_46.sql        2014-07-11 23:57:30 UTC (rev 13754)
+++ CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_45_to_46.sql        2014-07-12 01:30:42 UTC (rev 13755)
</span><span class="lines">@@ -68,17 +68,13 @@
</span><span class="cx"> 
</span><span class="cx"> create table GROUP_SHAREE (
</span><span class="cx">   GROUP_ID                      integer not null references GROUPS on delete cascade,
</span><del>-  CALENDAR_HOME_ID                                 integer not null references CALENDAR_HOME on delete cascade,
</del><span class="cx">   CALENDAR_ID                                      integer not null references CALENDAR on delete cascade,
</span><span class="cx">   GROUP_BIND_MODE               integer not null, -- enum CALENDAR_BIND_MODE
</span><span class="cx">   MEMBERSHIP_HASH               varchar(255) not null,
</span><span class="cx">   
</span><del>-  primary key (GROUP_ID, CALENDAR_HOME_ID, CALENDAR_ID) -- implicit index
</del><ins>+  primary key (GROUP_ID, CALENDAR_ID) -- implicit index
</ins><span class="cx"> );
</span><span class="cx"> 
</span><del>-create index GROUP_SHAREE_CALENDAR_HOME_ID on GROUP_SHAREE(
-        CALENDAR_HOME_ID
-);
</del><span class="cx"> create index GROUP_SHAREE_CALENDAR_ID on GROUP_SHAREE(
</span><span class="cx">         CALENDAR_ID
</span><span class="cx"> );
</span></span></pre></div>
<a id="CalendarServerbranchesusersgayagroupsharee2txdavcommondatastoresql_schemaupgradespostgresdialectupgrade_from_45_to_46sql"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_45_to_46.sql (13754 => 13755)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_45_to_46.sql        2014-07-11 23:57:30 UTC (rev 13754)
+++ CalendarServer/branches/users/gaya/groupsharee2/txdav/common/datastore/sql_schema/upgrades/postgres-dialect/upgrade_from_45_to_46.sql        2014-07-12 01:30:42 UTC (rev 13755)
</span><span class="lines">@@ -62,16 +62,13 @@
</span><span class="cx"> 
</span><span class="cx"> create table GROUP_SHAREE (
</span><span class="cx">   GROUP_ID                      integer not null references GROUPS on delete cascade,
</span><del>-  CALENDAR_HOME_ID                                 integer not null references CALENDAR_HOME on delete cascade,
</del><span class="cx">   CALENDAR_ID                                      integer not null references CALENDAR on delete cascade,
</span><span class="cx">   GROUP_BIND_MODE               integer not null, -- enum CALENDAR_BIND_MODE
</span><span class="cx">   MEMBERSHIP_HASH               varchar(255) not null,
</span><span class="cx">   
</span><del>-  primary key (GROUP_ID, CALENDAR_HOME_ID, CALENDAR_ID) -- implicit index
</del><ins>+  primary key (GROUP_ID, CALENDAR_ID) -- implicit index
</ins><span class="cx"> );
</span><span class="cx"> 
</span><del>-create index GROUP_SHAREE_CALENDAR_HOME_ID on
-  GROUP_SHAREE(CALENDAR_HOME_ID);
</del><span class="cx"> create index GROUP_SHAREE_CALENDAR_ID on
</span><span class="cx">   GROUP_SHAREE(CALENDAR_ID);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>