[CalendarServer-changes] [8792] CalendarServer/branches/users/glyph/case-insensitive-uid
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 29 10:16:04 PST 2012
Revision: 8792
http://trac.macosforge.org/projects/calendarserver/changeset/8792
Author: glyph at apple.com
Date: 2012-02-29 10:16:04 -0800 (Wed, 29 Feb 2012)
Log Message:
-----------
Support data-version upgrade from 1 to 2 against more recent schema-versions.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/case-insensitive-uid/txdav/common/datastore/upgrade/sql/upgrades/upgrade_from_1_to_2.py
Property Changed:
----------------
CalendarServer/branches/users/glyph/case-insensitive-uid/
Modified: CalendarServer/branches/users/glyph/case-insensitive-uid/txdav/common/datastore/upgrade/sql/upgrades/upgrade_from_1_to_2.py
===================================================================
--- CalendarServer/branches/users/glyph/case-insensitive-uid/txdav/common/datastore/upgrade/sql/upgrades/upgrade_from_1_to_2.py 2012-02-29 18:16:01 UTC (rev 8791)
+++ CalendarServer/branches/users/glyph/case-insensitive-uid/txdav/common/datastore/upgrade/sql/upgrades/upgrade_from_1_to_2.py 2012-02-29 18:16:04 UTC (rev 8792)
@@ -36,15 +36,18 @@
"""
yield moveSupportedComponentSetProperties(sqlStore)
yield splitCalendars(sqlStore)
-
+
# Always bump the DB value
yield updateDataVersion(sqlStore, "CALENDAR-DATAVERSION", UPGRADE_TO_VERSION)
+
+
@inlineCallbacks
def moveSupportedComponentSetProperties(sqlStore):
"""
- Need to move all the CalDAV:supported-component-set properties in the RESOURCE_PROPERTY
- table to the new CALENDAR table column, extracting the new format value from the XML property.
+ Need to move all the CalDAV:supported-component-set properties in the
+ RESOURCE_PROPERTY table to the new CALENDAR_METADATA table column,
+ extracting the new format value from the XML property.
"""
sqlTxn = sqlStore.newTransaction()
@@ -53,21 +56,22 @@
for calendar_rid, value in rows:
prop = WebDAVDocument.fromString(value).root_element
supported_components = ",".join(sorted([comp.attributes["name"].upper() for comp in prop.children]))
-
- cal = schema.CALENDAR
+ meta = schema.CALENDAR_METADATA
yield Update(
{
- cal.SUPPORTED_COMPONENTS : supported_components
+ meta.SUPPORTED_COMPONENTS : supported_components
},
- Where=(cal.RESOURCE_ID == calendar_rid)
+ Where=(meta.RESOURCE_ID == calendar_rid)
).on(sqlTxn)
-
+
yield removeProperty(sqlTxn, caldavxml.SupportedCalendarComponentSet)
yield sqlTxn.commit()
except RuntimeError:
yield sqlTxn.abort()
raise
+
+
@inlineCallbacks
def splitCalendars(sqlStore):
"""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120229/4a7524cb/attachment-0001.html>
More information about the calendarserver-changes
mailing list